Hello,
I have five groups (UserGrp1, UserGrp2, UserGrp3, UserGrp4, UserGrp5). The five groups total together have over 1000 users. I am currently using the statement below to find one user. For instance, I have the domain user named John Doe (sAMAcountName = JDOE)and I need to find the groups to which he belong. I do not have the Domain, DefaultOU, DefaultRootOU, ServiceUser or ServicePassword. How can I write the code find this person and know what group he actually belong with in these five groups.
GroupPrincipal gp1 = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name,
UserGrp1);
GroupPrincipal gp2 = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name,
UserGrp2);
GroupPrincipal gp3 = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name,
UserGrp3);
GroupPrincipal gp4 = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name,
UserGrp4);
GroupPrincipal gp5 = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name,
UserGrp5);