Dear Exprt,
Althought user member for group value come in false
bool result = true;
PrincipalContext context = new PrincipalContext(ContextType.Domain, "Mydomain");
UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(context, "test1");
GroupPrincipal groupPrincipal = GroupPrincipal.FindByIdentity(context, "ADgroup");
if (userPrincipal != null && groupPrincipal != null)
{
Console.WriteLine(groupPrincipal.Members.Contains(userPrincipal).ToString());
}
else
{
Console.WriteLine(result);
}
Support@Mytechnet.me