Software Development Network>> .NET Development>> Querying Active Directory in C#
Thank you so much for this post. I spent a couple hours trying to figure out why my using System..DirectoryServices was not compiling. the add reference was the key.
Querying Active Directory in C#
Ty Y
http://msdn2.microsoft.com/en-us/library/system.directoryservices.aspx
If you already know the ADsPath, you can use DirectoryEntry directly, for instance to retrieve the root:
DirectoryEntry entry = new DirectoryEntry("LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com");
If not, you can use DirectorySearcher to query for it. Check out the docs for examples on how to call it.
N.B. You'll need to Add Reference... to System.DirectoryServices and add a using directive for the namespace.
Hopefully this is enough to get you started. If you have a more specific problem, feel free to post it.
Marty01
Thank you so much for this post. I spent a couple hours trying to figure out why my using System..DirectoryServices was not compiling. the add reference was the key.