Last post Mar 16, 2006 04:20 PM by patrik.25
Mar 15, 2006 08:30 AM|patrik.25|LINK
I have some problems with getting the information about the users in a group. I need to get the Guid of the user and his name. I am using Win2k3Ent.Server and Framework 1.x. Thanks for you help.
Here is my code:
DirectoryEntry ent = new DirectoryEntry("LDAP://bla.bla.bla/CN=Staff,CN=Users,DC=bla,DC=bla,DC=bla");
DirectorySearcher directorySearcher = new DirectorySearcher(ent);
directorySearcher.Filter = "(& (objectClass=user)(objectCategory=person)(memberOf=CN=Staff))
SortedList users = new SortedList();
resultCollection1 = directorySearcher.FindAll();
foreach(SearchResult resEnt in resultCollection1)
DirectoryEntry ent = resEnt.GetDirectoryEntry();
Mar 16, 2006 04:59 AM|EgilOfBorg|LINK
As far as I know, you don't have to use the GetDirectoryEntry() on your search result. And, if you tell the DirectorySearch which properties to return, you can get all the info you need.
Here's a simple exampel (not sure if it works as you want with the SortedList):
If you need the guid, look in at this poste, dunnry has a solution for that posted there:
Also, the same exampel as the one above, the main difference is that the results are saved in a DataSet:
http://forums.asp.net/900432/ShowPost.aspx (scroll down to dunnry's post again).
Hope this helps, Egil.
Mar 16, 2006 09:07 AM|dunnry|LINK
Mar 16, 2006 04:20 PM|patrik.25|LINK