I need just the commonName of the groups a user is a member of.
DirectoryEntry user = new DirectoryEntry("LDAP://cn=myuser....");
foreach(string path in user.Properties["memberOf"])
Console.WriteLine(path);
then the memberOf property contains a set of strings, the full paths of the groups. That's makes sense, but it's not what I want.
I'm pretty sure I shoudn't new up a DirectoryEntry for each of those paths to get the common name, but is it the best idea to simply parse out the cn from the path? (that seems rather brutish)
There must be a better way to get a SearchResults of groups a users is a member of.
BTW, this is .NET 2, so I can't do any of the fancy LINQ to AD stuff nor do I have access to the new bits in DirectoryServices for ActiveDirectory.