VasquezPL 0 Junior Poster

I guys,
I have found out the way to do that with "directory searcher" method, but...Framework 3.5 has some serious bugs which make it impossible to list some of groups (>1300 members).
What I need to do is to list all members of a group in AD and to mark members which are nested (for example with a prefix [N] in name)
I have found out the code which list all members (even nested), but it doesn't mark them - so basicaly I need to know which members are nested, and which are only in the provided group.

    String listGroupUsers2(string GroupName)
    {
       PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domain);
       GroupPrincipal grp = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, GroupName);
       StringBuilder userList = new StringBuilder();
       if (grp != null)
       {
           foreach (Principal p in grp.GetMembers(true))
           {
           userList.Append(p.Name);
           userList.Append("\r\n");
           }
           grp.Dispose();
           ctx.Dispose();
        }
    tempreport1.AddRange(userList.ToString().Split(new string[] { "\r\n" }, StringSplitOptions.None).ToList());
    return userList.ToString();
    }

The best thing would be to make it looks like a tree:

MAIN_AD_GROUP
     |
     |-> SUB_GROUP
              | 
              |-> User

but marking users with [N] prefix would be good for the beggining.

THX for help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.