Click here to Skip to main content
15,914,014 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to get the group from the active directory and then from the group i want to find the members of that group

but when i search for solution i got groups via users who are belongs to which group

i am using winnt

C#
PrincipalContext ctx = new PrincipalContext(ContextType.Domain); // create ctx

using (ctx)
{
 Principal p1 = Principal.FindByIdentity(ctx, child.Name); // get Principal for the current user

    using (p1)
    {
                                                    
       var groups = p1.GetGroups();
       using (groups)
       {
       foreach (Principal group in groups) // cycle through all the groups for this user
       {
              // get group list 
                                                      
       } // end using (groups)

     } // end using (p)


this is my code in this code i am getting the group associated with users but i want to get group and that group belongs user

help me to solve this.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900