[Mono-list] DirectorySearcher.FindAll

Arnaud Bienvenu arnaud.bienvenu@makina-corpus.org
Tue, 30 Nov 2004 20:51:58 +0100


Doyle, Bryan I. a écrit :
> Has anyone been able to successfully run the findall() method of 
> system.directoryservices (it is a method of the directory searcher) ?

Yes. Here is my code :

string ldapUrl = "LDAP://ldap.example.com/ou=People,dc=example,dc=com";

DirectoryEntry userDirectory = new DirectoryEntry(ldapUrl, 
"uid=me,ou=People,dc=example,dc=com", "mypassword", 
AuthenticationTypes.ServerBind);

DirectorySearcher searcher = new DirectorySearcher(userDirectory);

searcher.Filter = "(ObjectClass=*)";

string[] properties = new string[] {"uid", "givenname"};
searcher.PropertiesToLoad.AddRange(properties);

SearchResultCollection results = searcher.FindAll();

I hope it helps. Else, you should explain your problem, so we may find a 
solution.

Regards,
-- 
Arnaud Bienvenu
Makina Corpus