| Author |
Message |
Bob
Guest
|
Posted:
Wed Nov 02, 2005 9:26 am Post subject:
Increasing the number of records Returned in an LDAP search |
|
|
Hi,
I am try to retrieve a large (20,000) number of user objects from Active
Directory.
The DirectorySearcher object has a SizeLimit property which I have set to
100,000; but still only 1,000 records get returned.
The help for this object says that the limit is also controlled by the
server
Where (and how) on the Server can I increase the number of objects returned
in any one query of Active Directory
Thanks
Bob
|
|
| Back to top |
|
 |
Bob
Guest
|
Posted:
Wed Nov 02, 2005 9:58 am Post subject:
Re: Increasing the number of records Returned in an LDAP sea |
|
|
Thanks Joe,
But the following code still only return 1000 items not the much larger
number I am expecting - what else do I need to do?
Thanks Again
Bob
ArrayList usrs = new ArrayList();
DirectorySearcher searcher;
SearchResultCollection results;
// Find all the users configured in the AD.
searcher = new DirectorySearcher();
searcher.SizeLimit = 1000;
searcher.Filter = "(&(objectClass=user)(objectCategory=person))";
searcher.PropertiesToLoad.Add("samaccountname");
searcher.PropertiesToLoad.Add("mail");
results = searcher.FindAll();
IEnumerator oe = results.GetEnumerator();
while (oe.MoveNext() == true)
{
usrs.Add(oe.Current);
}
MessageBox.Show(usrs.Count.ToString());
"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
in message news:e2rnoN23FHA.3592@TK2MSFTNGP12.phx.gbl...
| Quote: | Set the PageSize property to 1000. This will enabled paged results under
the hood and all results will be returned as you enumerate the search
results.
Do not modify the maxPageSize query policy on the domain controller. This
policy is in place to help protect the DC from denial of service attacks
and there is no need to change it given that paged searches are available.
Joe K.
"Bob" <someone@microsoft.com> wrote in message
news:u5qm7x13FHA.2532@TK2MSFTNGP09.phx.gbl...
Hi,
I am try to retrieve a large (20,000) number of user objects from Active
Directory.
The DirectorySearcher object has a SizeLimit property which I have set to
100,000; but still only 1,000 records get returned.
The help for this object says that the limit is also controlled by the
server
Where (and how) on the Server can I increase the number of objects
returned in any one query of Active Directory
Thanks
Bob
|
|
|
| Back to top |
|
 |
Joe Kaplan (MVP - ADSI)
Guest
|
Posted:
Wed Nov 02, 2005 9:58 am Post subject:
Re: Increasing the number of records Returned in an LDAP sea |
|
|
Set the PageSize property to 1000. This will enabled paged results under
the hood and all results will be returned as you enumerate the search
results.
Do not modify the maxPageSize query policy on the domain controller. This
policy is in place to help protect the DC from denial of service attacks and
there is no need to change it given that paged searches are available.
Joe K.
"Bob" <someone@microsoft.com> wrote in message
news:u5qm7x13FHA.2532@TK2MSFTNGP09.phx.gbl...
| Quote: | Hi,
I am try to retrieve a large (20,000) number of user objects from Active
Directory.
The DirectorySearcher object has a SizeLimit property which I have set to
100,000; but still only 1,000 records get returned.
The help for this object says that the limit is also controlled by the
server
Where (and how) on the Server can I increase the number of objects
returned in any one query of Active Directory
Thanks
Bob
|
|
|
| Back to top |
|
 |
Marc Scheuner [MVP ADSI]
Guest
|
Posted:
Wed Nov 02, 2005 9:58 am Post subject:
Re: Increasing the number of records Returned in an LDAP sea |
|
|
| Quote: | But the following code still only return 1000 items not the much larger
number I am expecting - what else do I need to do?
|
Yes - read JoeK posting and follow his advice - set the *PageSize* to
1000.
| Quote: | DirectorySearcher searcher = new DirectorySearcher();
searcher.SizeLimit = 1000;
|
searcher.PageSize = 1000;
Marc
________________________________________________________________
Marc Scheuner ** mscheuner -at- mvps.org ** http://adsi.mvps.org
Microsoft MVP for Directory Services Programming
http://www.dirteam.com/blogs/mscheuner/default.aspx
http://groups.yahoo.com/group/ADSIANDDirectoryServices/ |
|
| Back to top |
|
 |
Joe Kaplan (MVP - ADSI)
Guest
|
Posted:
Wed Nov 02, 2005 5:58 pm Post subject:
Re: Increasing the number of records Returned in an LDAP sea |
|
|
Thank you Marc. :)
Joe K.
"Marc Scheuner [MVP ADSI]" <m.scheuner@inova.SPAMBEGONE.ch> wrote in message
news:0gngm194q39bstce3b6aj8f84e8cf4qrcr@4ax.com...
|
|
| Back to top |
|
 |
Bob
Guest
|
Posted:
Thu Nov 03, 2005 1:58 am Post subject:
Re: Increasing the number of records Returned in an LDAP sea |
|
|
Doh!
"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
in message news:uUIlFk83FHA.696@TK2MSFTNGP09.phx.gbl...
| Quote: | Thank you Marc. :)
Joe K.
"Marc Scheuner [MVP ADSI]" <m.scheuner@inova.SPAMBEGONE.ch> wrote in
message news:0gngm194q39bstce3b6aj8f84e8cf4qrcr@4ax.com...
But the following code still only return 1000 items not the much larger
number I am expecting - what else do I need to do?
Yes - read JoeK posting and follow his advice - set the *PageSize* to
1000.
DirectorySearcher searcher = new DirectorySearcher();
searcher.SizeLimit = 1000;
searcher.PageSize = 1000;
Marc
________________________________________________________________
Marc Scheuner ** mscheuner -at- mvps.org ** http://adsi.mvps.org
Microsoft MVP for Directory Services Programming
http://www.dirteam.com/blogs/mscheuner/default.aspx
http://groups.yahoo.com/group/ADSIANDDirectoryServices/
|
|
|
| Back to top |
|
 |
|
|
|
|