The code is just like:

                string strPath = "LDAP://OU=,DC=,DC=";
                DirectoryEntry myDE = new DirectoryEntry(strPath);
                DirectoryEntry newUser = myDE.Children.Add("cn=" + userName, "User");
                newUser.Properties["sAMAccountName"].Add(userName);
                newUser.Properties["displayName"].Add(userName);
                //newUser.Properties["streetAddress"].Add("");
                newUser.CommitChanges();

                newUser.Invoke("SetPassword", new object[] { "123456" });
                newUser.CommitChanges();



Then  you can add it to the existing roles.

posted on 2006-09-06 15:36  有些伤感  阅读(460)  评论(0编辑  收藏  举报