.NET Active Directory Wrapper    
Access Active Directory From Your C# or VB .Net Code
 

Checking if an Active Directory Group Exists using C# or VB .Net

With this function you can check if an Active Directory Group exists or not. Simply returns a boolean.

Method: GroupExists

Parameters:  (string) Group

Programming Languages Supported

ASP.NET, C#, VB.Net, Visual Studio 2010, Visual Sutdio 2012

Precondition

An instance of the LDAP manager must be instantiated for a valid ADDS server and logged in.

Functionality

The method is called passing the Group as a string. Three things can then occur:

  1. If the Group exists and the method returns true.
  2. If the Group does not exist the method returns false
  3. An Exception will be thrown for other errors

Example

Where LdapConnection is an instance of LdapManager

 public Boolean groupExists(String group)
        {
            try
            {
                return LdapConnection.GroupExists(group);
            }
            catch (Exception)
            {

                throw;
            }
        }

Post Condition

There is no residual state the connection remains connected to the ADDS server