[英]How to delete a OpenLdap Object in C#?
I am using C# to manipulate openldap objects, now I can use System.DirectoryServices.DirectoryEntry class to implement most of the methods (adding & modifying objects) expect for deleting an object. 我正在使用C#操作openldap对象,现在可以使用System.DirectoryServices.DirectoryEntry类来实现大多数删除对象的方法(添加和修改对象)。 I am using the DirectoryEntry.DeleteTree method to delete an object now but I get an error:"treeDelete control value not absent".
我现在使用DirectoryEntry.DeleteTree方法删除对象,但收到错误消息:“不存在treeDelete控件值”。 Does the method only work with AD?
该方法仅适用于AD吗? or I have to use DeleteRequest and LdapConnection classes in System.DirectoryServices.Protocols to delete an object?
还是我必须在System.DirectoryServices.Protocols中使用DeleteRequest和LdapConnection类来删除对象?
I am wondering if there is a way and prefer to use DirectoryEntry to delete an object. 我想知道是否有办法并且更喜欢使用DirectoryEntry删除对象。
Thanks so much. 非常感谢。
Have come out the solution now, and it's quite simple, just like this: 现在提出解决方案,它非常简单,就像这样:
var de = GetAgentEntry();
var pa = de.Parent;
pa.Children.Remove(de);
pa.CommitChanges();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.