LDAP: How to retrieve 100,000 records from Active directory using LDAP

How to retrieve 100,000 records from Active directory using LDAP

Problem:

I want to retrieve nearly 100,000 records from Active directory. But currently I am able to retrieve only 1000 records per search. After 1000th record, it gives LDAP error 4 Maximum Limit Exceeded error….. Can any one throw some light on this issue….. with some working codes

Solution:

The following quote from MSDN. It may give you some help

The SizeLimit and PageSize properties both affect the number of items that are returned by a search. The SizeLimit property sets the maximum number of items that will be returned by a search, but there may be other search result limitations imposed by the underlying directory service. For example, Active Directory limits the maximum number of search results to 1000. In this case, setting the SizeLimit property to a value greater than 1000 has no effect.

The PageSize property sets the maximum number of items in each page of results that will be returned by a search. The page size is also affected by the underlying directory service. With Active Directory, the largest page size is 1000. Any value over 1000 will be ignored. If PageSize is set to its default value (zero), no paging will occur and the maximum number of items returned by the search will be the lesser of SizeLimit and 1000.

To retrieve a set of results that is larger than 1000 items, you must set SizeLimit to its default value (zero) and set PageSize to a value that is less than or equal to 1000. For example, if a search will result in 12,000 items being returned and SizeLimit is set to 500, a total of 500 items will be returned. If, however, SizeLimit is set to zero and PageSize is set to 500, the search will return all 12,000 results in pages of 500 items, with the last page containing only 200 items. The paging occurs transparently to the application and the application does not have to perform any special processing other than setting the PageSize property to the proper value.

Reference:

http://forums.devshed.com/ldap-programming-76/how-to-retrieve-100-000-records-from-active-directory-using-204417.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s