DynDeveloper.com

DynDeveloper.com

Sign Up Now! Log In
steve gray 8/9/2011 7:05:02 AM

Querying Active Directory From .NET

On a recent project, I needed to query Active Directory to get a list of people in a specific group.  I didn't find much sample code for this so i thought i'd post what I figured out. 

This function returns the users in the current active directory group.  It does this by getting a list of all the users and checking what group they are in.

The group itself lists what users are in it, but it stores the display name not the user name.

This code may not be scalable, but it worked for us. I read, but haven't tested, that ldap queries limit to 1000 results so this may be a problem if there are more than 1000 users.

 

Version: Unknown or N/A
Section: .NET Development