using DirectorySearcher to get Group members
-
how could i change this code to use the DirectorySearcher to get me all members in the group the reason i want to use the DirectorySearcher is because i can set the PageSize so i can get more than 1,000 users currently all these groups have over 2,000 users public static ArrayList testGetUsers() { ArrayList excludeGroups = new ArrayList(); ArrayList users = new ArrayList(); DirectoryEntry group; excludeGroups.Add("CN=GMDPortal,OU=IT,OU=ADM,DC=corp,DC=ad,DC=ejhospital,DC=com"); excludeGroups.Add("CN=GService,OU=SysServices,DC=corp,DC=ad,DC=ejhospital,DC=com"); excludeGroups.Add("CN=GTrain,OU=Training,OU=ADM,DC=corp,DC=ad,DC=ejhospital,DC=com"); excludeGroups.Add("CN=GITLevSvcs,OU=LevSvcs,OU=IT,OU=ADM,DC=corp,DC=ad,DC=ejhospital,DC=com"); foreach (string DEgroup in excludeGroups) { group = new DirectoryEntry("LDAP://" + DEgroup); foreach (object dn in group.Properties["member"]) { users.Add(dn); } } return users; }