Retrieving User Active Directory Object using C# or VB .NET
The method retrieves an LDAPUser object, which is the object that represents the Active Directory object. The object contains methods and properties related to an Active Directory user.
Langauges Supported
ASP.NET, C#, VB.Net, Visual Studio 2010, Visual Sutdio 2008
Method: GetUser
Parameters: UserProperty (Username or Email) ,
(string) Property Value
The UserProperty method indicates how the wrapper should search for the user. The options here are Username or Email.
Precondition
An instance of the LDAPmanager must be instantiated for a valid ADDS server,
and the instance must be logged on.
Functionality
The method is called passing the Username or the email address as a string. Three
things can then occur:
- If the user detail exist and the method returns a LDAPUser object
- If the username does not exist the
method returns false
- An Exception will be thrown for other errors
Example
Where LdapConnection is an instance of LdapManager
public LdapUser GetUser(String Username)
{
try
{
return LdapConnection.GetUser(UserProperty.Username, Username);
}
catch (Exception)
{
throw;
}
}
Post Condition
The returned LDAPUser object is updatable
|