1

Possible Duplicate:
Is the directorysearcher object capped at 5000 even if pagesize is set to greater

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?

Community
  • 1
  • 1
Paolo Tedesco
  • 55,237
  • 33
  • 144
  • 193
  • Or see here: http://stackoverflow.com/questions/1508150/is-the-directorysearcher-object-capped-at-5000-even-if-pagesize-is-set-to-greater – marc_s Oct 15 '09 at 09:06

0 Answers0