How do I add new entries with LDAP?

How do I add new entries with LDAP?

Date Entered: 09/26/2007    Last Updated: 09/26/2007

To add a new LDAP entry, first bind as a user with permissions to add:
ldap.DN = "DOMAIN\\Administrator";
ldap.Password = "admin";
ldap.Bind();
Next, specify the new DN you'd like to add, and specify all the attributes that will be required in order to add this new entry to the server. Which attributes are required depend on the schema. For Active Directory, a typical user DN add might look like this:
ldap.DN = "cn=NewUser,cn=Users,dc=DOMAIN";
ldap.Attributes.Add(new LDAPAttribute("objectClass", "top"));
ldap.Attributes.Add(new LDAPAttribute("", "person"));
ldap.Attributes.Add(new LDAPAttribute("", "organizationalPerson"));
ldap.Attributes.Add(new LDAPAttribute("", "inetorgperson"));
ldap.Add();
Next, you can go back and use the Modify method to add other attributes to this entry.

We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.