0
我正在尝试编写一个程序,该程序会使用来自外部数据源的数据自动创建活动目录帐户。我遇到的问题是,我总是得到一个UnAuthorizedAccessException,但是我终身无法考虑应用什么权限。我甚至一直走到根对象,并给予我自己的帐户完全控制,这似乎没有任何区别。我知道我可以访问服务器,因为organizationUnit和de对象正确填充。通过代码添加Active Directory帐户所需的权限
DirectoryEntry de = new DirectoryEntry("LDAP://MYLOCALADDRESS");
de.Password = "thePassword";
de.Username = "theUserName";
de.AuthenticationType = AuthenticationTypes.Secure ;
DirectoryEntry organizationalUnit = de.Parent;
DirectoryEntry newUser = organizationalUnit.Children.Add("TESTADD ", de.SchemaClassName);
//Exception happens on this line
newUser.CommitChanges();
任何帮助,将不胜感激!
终于想通了,我试图添加到我的生产活动目录中,而不是我设置的测试。然后你的提示与cn =确实有帮助。 –