Click here to Skip to main content
16,020,162 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I hope so You can help me. I need display in ListBox all users from AD with CN, MOBILE, MAIL. For example: Tom Ohnik +4232684345 to@gmail.com What should I add?

DirectoryEntry dir = new DirectoryEntry("LDAP://ou=outest,ou=ouGB,DC=GB,DC=,DC=local");
            DirectorySearcher search = new DirectorySearcher(dir);
            search.Filter = "(&(objectClass=user))"; // (mobile=+44*))";
            search.SearchScope = SearchScope.Subtree;
            search.PropertiesToLoad.Add("cn");
            search.PropertiesToLoad.Add("mobile");
            search.PropertiesToLoad.Add("mail");
            SearchResultCollection searchresult = search.FindAll();
            if (searchresult != null) ......


Regards,
Tom
Posted
Comments
Henry Minute 22-Feb-11 10:59am    
What do you want to display in the ListBox?
Just the name or some combination of the returned data?
Member 3568076 22-Feb-11 12:26pm    
Hi Henry, I woould like display just returned data and sort it per surname. I have about 1000 users. Also I need program in listbox function selected iteam and selecting users from listbox useing keys from keyboard (2 or 3 first letter of surname) - this I think I now how to do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900