将子项添加到EntryDirectory错误

时间:2018-04-25 05:38:57

标签: c# linux ldap

当我想添加目录时,我通过ldap连接连接到linux系统 我有一个问题,添加到EntryDirectory的子, myDirectoryEntry.CommitChanges();有例外

static void Add(DirectoryEntry entry)
    {
        DirectoryEntries myEntries = entry.Children;
        DirectoryEntry myDirectoryEntry = myEntries.Add("AccountNumber=3", "simpleSecurityObject");
        myDirectoryEntry.Properties["sn"].Value = 3;
        myDirectoryEntry.Properties["firstname"].Value = "test name";
        myDirectoryEntry.Properties["lastname"].Value = "test family";
        myDirectoryEntry.CommitChanges();
        entry.CommitChanges();
        Console.WriteLine(myDirectoryEntry.Name + " entry is created in container.");
    }

0 个答案:

没有答案