I'm trying to find the simplest way to query Active Directory, in one of two ways:
Given an AD username, find all the groups (INCLUDING nested groups) that the user is a member of.
Given an AD group name, find all the users (including those users in nested groups) that are part of the group.
My app is in VB.NET on the v4.0 framework. I've reviewed suggestions from many different Google search results, some of which utilize LDAP and System.DirectoryServices.DirectorySearcher (which I'm thinking might be the best route).
But I'm spinning my wheels and am looking for code samples.
Thank you.
UPDATE:
I've got these pieces in place:
<add assembly="System.DirectoryServices, Version=3.5.0.0, etc."/>
<add namespace="System.DirectoryServices.AccountManagement" />
or Imports System.DirectoryServices.AccountManagement
and on this line of code:
Dim ctx As New PrincipalContext(ContextType.Domain)
I still get this error: Type 'PrincipalContext' is not defined
When you mention the "using statement," I assume you meant that I need to reference this namespace. Or did you mean I should do something like this?
Using ctx As New PrincipalContext(ContextType.Domain)