Adding new user To The Directory : User Add « Directory Services « C# / CSharp Tutorial






using System;
using System.DirectoryServices;

public class MainClass
{
  public static int Main(string[] args)
  {
    DirectoryEntry MyObject = new DirectoryEntry();
    MyObject.Path = "LDAP://HMSRevenge/OU=Users,DC=Test,DC=com";

    DirectoryEntries users = MyObject.Children;

    DirectoryEntry NewUser = users.Add("Name", "user");
    NewUser.Properties["company"].Add("Corporation");
    NewUser.Properties["employeeID"].Add("1001");
    NewUser.Properties["userPassword"].Add("Password");

    NewUser.CommitChanges();

    return 0;
  }
}








34.10.User Add
34.10.1.Add user
34.10.2.Adding new user To The Directory
34.10.3.List user