I'm running a query on a container to determine how many objects it contains:
DirectoryEntry entry = new DirectoryEntry("LDAP://CN=Users,DC=XXX,DC=YYY");
string filter = "(objectClass=Person)";
string[] properties = { "distinguishedName" };
DirectorySearcher search = new DirectorySearcher(entry, filter, properties, SearchScope.Subtree);
var results = search.FindAll();
foreach (SearchResult result in results) {
Console.WriteLine(result.Path);
}
Console.WriteLine(results.Count);
entry.Close();
However the query always returns at most 2000 objects, even if I explicitly set a different size limit:
search.SizeLimit = 10000; // useless
How can I get all the results from the query?