Retrieving an Active Directory Group Object using C# or VB .Net
This method returns a single Group object from Active Directory which can then be manipulated and updated.
Method: GetGroup
Parameters: (string) Group
Programming Languages Supported
ASP.NET, C#, VB.Net, Visual Studio 2010, Visual Sutdio 2008
Precondition
An instance of the LDAP manager must be instantiated for a valid ADDS server
and be logged in.
Functionality
The method is called passing the Group as a string. Three
things can then occur:
- If the Group exists the method returns an LdapGroup object.
- If the Group does not exist the method returns a null object
- An Exception will be thrown for other errors
Example
Where LdapConnection is an instance of LdapManager
public LdapGroup GetGroup(String group)
{
try
{
return LdapConnection.GetGroup(group);
}
catch (Exception)
{
throw;
}
}
Post Condition
The Group object contains an updatable collection of User objects
|