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

Retreiving Organization Unit Object From Active Directory using C# or VB .Net

The method retrieves an updatable Organization Unit object.

Langauges Supported

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

Method: GetOrgUnit

Parameters:  (string) Organization Unit Name

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 Organization Unit as a string. Three things can then occur:

  1. If the Organization Unit exists and the method returns an LdapOU object..
  2. If the Organization Unit does not exist the method return a null object
  3. An Exception will be thrown for other errors

Example

Where LdapConnection is an instance of LdapManager

 public LdapOU GetOrgUnit(String ouName)
        {
            try
            {
                return LdapConnection.GetOU(ouName);
            }
            catch (Exception)
            {

                throw;
            }
        }

Post Condition

The retrieved object has two methods GetOUs and GetUsers