Query 1000 restriction problems in AD, ad1000
- MaxPageSize-this value controls the maximum number of independent objects returned for a single search result. The search result to be executed may exceed this number of objects. The client must specify a paging search control. This group groups the results returned by a group not greater than the value of MaxPageSize. In short, MaxPageSize controls the number of objects returned in a single search result.
Default Value: 1000
Set it in the codePageSize,
Reference code:
// Obtain all users in the Ad
Public static SearchResultCollection GetAllUsers (string adPath, string adMIN, string adPWD)
{
Try
{
DirectoryEntry entry = new DirectoryEntry (adPath, adMIN, adPWD, DefaultAuthenticationType );
// DirectoryEntry entry = new DirectoryEntry (ADPath, ADMIN, AdPWD, DefaultAuthenticationType );
DirectorySearcher directorySearch = new DirectorySearcher (entry );
// LDAP: // sensen.com/cn0000001216,ouyunuser,ouyunjr,dcyunsen,dcyuncom
DirectorySearch. Filter = "(& (objectClass = user ))";
// DirectorySearch. Filter = "(& (objectClass = organizationalUnit) (ou = JR ))";
DirectorySearch. Sort. PropertyName = "cn ";
DirectorySearch. SearchScope = SearchScope. Subtree;
DirectorySearch. PageSize = 5000;
SearchResultCollection results = directorySearch. FindAll ();
If (results! = Null)
{
Return results;
}
Else
{
Return null;
}
}
Catch (Exception ex)
{
Return null;
}
}
The problem has been addressed on Microsoft's website: http://support.microsoft.com/kb/315071