|
-
May 23rd, 2009, 03:08 PM
#1
Getting ActiveDirectory Listing
Hi, I have a piece of code (below) which grabs a list of users on an Active Directory. However it only seems to return the first 1500 users. Does anybody know how to modify this code so it returns all the users?
public ArrayList GetActiveADUsersInGroup()
{
ArrayList adUsersInGroup = new ArrayList();
String queryString = "LDAP://CN=ALL Employees,OU=Distribution Lists,OU=Exchange Objects,OU=System Management,DC=xxx,DC=corp,DC=local";
DirectoryEntry de = new DirectoryEntry(queryString);
PropertyValueCollection members = (PropertyValueCollection)de.Properties["member"];
foreach (object member in members)
{
String queryStringMember = "LDAP://" + member.ToString();
DirectoryEntry deMember = new DirectoryEntry(queryStringMember);
String windowsIdentityName = deMember.Properties["sAMAccountName"].Value.ToString();
adUsersInGroup.Add(windowsIdentityName);
}
return adUsersInGroup;
}
Thanks in advance
Srinu
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|