The way the DirectorySearcher (and IDirectorySearch) work is that the paging is transparent to you. You call the search and just start enumerating the results. Every time a new page is needed, it will fetch one for you.
One big mistake to avoid with the DirectorySearcher is to ever use the Count property on the SearchResultCollection. Calling it forces the entire result to be fetched first so it can get a count of the results. Not good! If you just jump in with "For Each", you should start seeing results right away. If you want fine-grained control of paging, you need to either jump to LDAP native code or wait for the .NET 2.0 System.DirectoryServices.Protocols stack. It provides all the low level access to paging. This requires more code though too. HTH, Joe K. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mikael H�kansson Sent: Thursday, March 03, 2005 9:59 AM To: [email protected] Subject: [ActiveDir] DirectoryServices: Paged searches Hi I�m using the DirectoryServices namespace to collect contacts from active directory. To avoid timeouts and the 1000 object server limit, I�m using paged searches. However, the DirectorySercher seems to be a bit limited. Whenever the DirSearcher.FindAll() function is called, It does not returned the control back to the thread that called it until ALL contacts are retrieved. This is a major drawback if there are thousands of contacts matching the search criteria (takes time). Is there a way of e.g have every page returned and then continue the search where it left off (using diretoryservices)? //Mikael List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
