I'm rewriting my C# program to Java and became very curios about the fact that C# application can extract tens of thousands of users with this trick:
DirectorySearcher search = new DirectorySearcher(entry);
search.SizeLimit = 99000;
search.PageSize = 98000;
but my Java programs firmly say
LDAPSearchException(resultCode=4 (size limit exceeded), numEntries=1000, numReferences=0, errorMessage='size limit exceeded')
I tried both unboundid and standard libraries. Found million discussions about this problem and everywhere is said - the limitation is on server, you can do nothing.
But my C# application does work! How can this happen? Secret techniques from Microsoft, that cannot be repeated by other vendors?
Just in case, my code is:
SearchRequest searchRequest = new SearchRequest(path, SearchScope.SUB, filter, "SamAccountName");
searchRequest.setSizeLimit(99000);
searchRequest.setTimeLimitSeconds(999);
SearchResult result = connection.search(searchRequest);
for (SearchResultEntry sre : result.getSearchEntries()) {
System.out.println(count++ + ": " + sre.toString());
}
for unboundid
p.s. I do not want to use workaround with searching for a*, b*, c* et c. Especially, considering that usernames might be not only in English.
Further reading showed, that unboundid does support paged mode, so problem is solved.