Tag Archives: 1000

C# DirectorySearcher search result more than 1000

When searching Active directory, DirectorySearcher will be used to retrieve information from Active Directory. Below is the code that gets the username information.   string DomainPath = “LDAP://DC=domain,DC=com”; DirectoryEntry searchRoot = new DirectoryEntry(DomainPath); DirectorySearcher search = new DirectorySearcher(searchRoot); search.Filter = “(&(objectClass=user)(objectCategory=person))”; search.PropertiesToLoad.Add(“samaccountname”); SearchResult result; SearchResultCollection resultCol = search.FindAll(); foreach(SearchResult item in resultCol ) { string

Read More