How PagedSearching works with DirectorySearcher

R

Randy Bradley

While I can't find any documentation on how PagedSearching works for
the DirectorySearcher, I think I have the basics figured out. The
purpose of this post is to see if anybody out there can verify this,
and answer one remaining question.

When you set PaqeSize to any non-zero value, the call to
DirectorySearcher.FindAll() returns only an empty
SearchResultsCollection. In fact, FindAll() doesn't even touch the
directory at all. The reads to the directory occur when you access the
SearchResultsCollection.

If you get the Count of the SearchResultsCollection or access a
specific result using an indexer, then the entire
SearchResultsCollection is filled in (over 3000 in my case). However,
if you enumerate through the collection (using foreach()) then the
SearchResultsCollection is read using PageSize chunks as needed. For
instance, if the PageSize is set to 5, then on the first foreach()
loop, it reads in 5 objects, and when you get to the 6th object, it
reads in objects 6-10, ect.

My question is this: Is there any way to access the Nth page of
objects without reading all the prior pages. I tried :

SearchResult result = results[6];

but this fills the entire SearchResults collection just like getting
the SearchResultsCollection.Count does.

Any help is appreciated,
Thanks
Randy.
 
B

Brian Desmond [MVP]

Randy-

I'd repost this in the ADSI newsgroups, as the people there are the experts
on this sort of thing.

--
--
Brian Desmond
Windows Server MVP
(e-mail address removed)12.il.us

Http://www.briandesmond.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top