Jon*_*Jon 4 c# active-directory
所以下面的代码应该在活动目录中移动一个对象.我看到这里发生了什么,但我不太明白.所有我看到的是旧位置和新位置.我没看到我是如何抓住这个物体的.我在这两个位置都有几个对象,这段代码在哪里说明要移动哪个特定对象?我没有看到LDAP + objectLocation字符串中有哪个对象.
DirectoryEntry eLocation = new DirectoryEntry("LDAP://" + objectLocation);
DirectoryEntry nLocation = new DirectoryEntry("LDAP://" + newLocation);
string newName = eLocation.Name;
eLocation.MoveTo(nLocation, newName);
nLocation.Close();
eLocation.Close();
Run Code Online (Sandbox Code Playgroud)
Pao*_*sco 14
也许这个例子会让它更清晰:
DirectoryEntry theObjectToMove = new DirectoryEntry("LDAP://CN=jdoe,CN=Users,DC=acme,DC=com");
DirectoryEntry theNewParent = new DirectoryEntry("LDAP://OU=Something,DC=acme,DC=com");
theObjectToMove.MoveTo(theNewParent);
Run Code Online (Sandbox Code Playgroud)
MoveTo
带有两个参数的重载也指定了对象的新名称,我认为在您的示例中它是多余的.
归档时间: |
|
查看次数: |
7801 次 |
最近记录: |