Increasing the number of records Returned in an LDAP search
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ExchangeServerHelp.com
Increasing the number of records Returned in an LDAP search

 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
Bob
Guest





Posted: Wed Nov 02, 2005 9:26 am    Post subject: Increasing the number of records Returned in an LDAP search Reply with 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
Bob
Guest





Posted: Wed Nov 02, 2005 9:58 am    Post subject: Re: Increasing the number of records Returned in an LDAP sea Reply with quote

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 Reply with 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...
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 Reply with quote

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 Reply with quote

Thank you Marc. :)

Joe K.

"Marc Scheuner [MVP ADSI]" <m.scheuner@inova.SPAMBEGONE.ch> wrote in message
news:0gngm194q39bstce3b6aj8f84e8cf4qrcr@4ax.com...
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.

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
Bob
Guest





Posted: Thu Nov 03, 2005 1:58 am    Post subject: Re: Increasing the number of records Returned in an LDAP sea Reply with quote

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
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server Dedicated Servers
New Topics Powered by phpBB