4
개체 클래스 사람 및 uidObject을 사용하여 OpenLDAP에 새 사용자 레코드를 만들려고합니다. 문제는 System.DirectoryServices.DirectoryEntry에서 하나의 객체 클래스로 새로운 항목을 추가하는 방법을 찾았지만 여러 객체 클래스를 추가하는 방법이 아닌 것 같습니다.C# 여러 개체 클래스를 사용하여 LDAP에 항목을 추가하는 방법
이 C# 코드
DirectoryEntry nRoot = new DirectoryEntry(path);
nRoot.AuthenticationType = AuthenticationTypes.None;
nRoot.Username = username;
nRoot.Password = pwd;
try
{
DirectoryEntry newUser = nRoot.Children.Add("CN=" + "test", "person");
newUser.Properties["cn"].Add("test");
newUser.Properties["sn"].Add("test");
newUser.Properties["objectClass"].Add("uidObject"); // this doesnt't make a difference
newUser.Properties["uid"].Add("testlogin"); // this causes trouble
newUser.CommitChanges();
}
catch (COMException ex)
{
Console.WriteLine(ex.ErrorCode + "\t" + ex.Message);
}
... 오류가 발생합니다 :
-2147016684 The requested operation did not satisfy one or more constraints associated with the class of the object. (Exception from HRESULT: 0x80072014)