Getting a list of All User Objects From Active Directory using C# or VB .Net
This method returns a collection of LdapUser objects that represent Active Directory users.
Langauges Supported
ASP.NET, C#, VB.Net, Visual Studio 2010, Visual Sutdio 2008
Method: GetUsers
Parameters: there is an overloaded method:
UserProperty (Username or Email), (string) Value
Precondition
An instance of the LDAP manager must be instantiated for a valid ADDS server
and logged on
Functionality
The method is called,optionally passing the parameters. Two
things can then occur:
- The method returns a Collection of LdapUser Objects
- An Exception will be thrown for any errors
Example
Where LdapConnection is an instance of LdapManager
public LdapUserCollection GetUsers()
{
/* There is an overload to take a property */
try
{
return LdapConnection.GetUsers();
/* return LdapConnection.GetUsers(UserProperty.Username,"Larry") */
}
catch (Exception)
{
throw;
}
}
Post Condition
The collection of LdapUser Objects may be updated
|