Creating an Organizational Unit in Active Directory using C# or VB .Net
It is possible to create a new ADDS Organization Unit using the LDAPManager
Parameters: (string) Organization Unit
Programming Languages Supported
ASP.NET, C#, VB.Net, Visual Studio 2010, Visual Sutdio 2012
An instance of the LDAP manager must be instantiated for a valid ADDS server
and must be logged in.
The method is called passing the Organization Unit as a string. Three
things can then occur:
- If the Organization Unit is created and the method a valid Organization
- If the Organization Unit exists the method throws an error.
- An Exception will be thrown for other errors
Where LdapConnection is an instance of LdapManager
public Boolean CreateOU(String orgUnit)
LdapOU ldapGroup = LdapConnection.CreateOU(orgUnit);
It should be noted that there is no residual connection to the authenticated
User Name, this method does not result in any "Login" context.