How to query large result sets?

Jan 28, 2009 at 2:51 PM
For some accounting project I need to query all users. Now I saw Active Directory returns for the 'user' objectClass a maximum of 5000 records. After doing some research I found you can do something with 'someSearcher.PropertiesToLoad.Add(String.Format("member;range={0}-{1}", rangeStart, rangeEnd))'. Other scripts do something like getting all users starting with 'a*' then 'b*'. The last I think is very tricky stuff...

For this CodePlex project method 'private IEnumerator<T> GetResults()' contains the following code: 

            DirectorySearcher s = new DirectorySearcher(root, q, properties.ToArray(), _source.Scope);

This 'properties' HashSet is 'filled' in method 'FindProperties'. So I think there must be some support for what I want but I cannot find out how.

By the way, I tried adding it myself directly to the codeplex (for testing purposes) but this did not seem to work (so adding 's.PropertiesToLoad.Add(String.Format("member;range={0}-{1}", 0, 50));' into method 'GetResults'.

Thanks for any help!

Yours sincerely,

Evert Wiesenekker
Jan 30, 2009 at 12:42 PM
Well I had overlooked/missed the 'Issue Tracker'. Someone named 'afraan' wrote an enhanced version of the 'DirectorySource' class, see issue 'Code to Handle results greater than 1000'.