I’m looking at the DirectoryServices namespace and I’m trying to get a list of all groups in the AD and load them into a listbox.
When I select a group, I want it to fill a text box with the manager’s name as well another listbox with all users assigned to that group. I’m having a hard time wrapping my head around the process. Could someone help me out?
If I get a full example of this, I’m fairly sure that I’ll understand the bigger picture a lot better. TIA
If you’re running on .NET 3.5 or newer, you can use a
PrincipalSearcherand a “query-by-example” principal to do your searching:If you haven’t already – absolutely read the MSDN article Managing Directory Security Principals in the .NET Framework 3.5 which shows nicely how to make the best use of the new features in
System.DirectoryServices.AccountManagementWhen you have a given group, you can easily get all its group members by using: