Delete user in active directory using c#

前端 未结 2 1519
感动是毒
感动是毒 2020-12-31 16:39

I\'ve written some code but not works it throws Exception \"An operations error occurred.\" code --->

DirectoryEntry dirEntry = new DirectoryEntry(\"LDAP pat         


        
2条回答
  •  时光取名叫无心
    2020-12-31 17:19

    When you are already using a DirectoryEntry there is no need for PrincipalContext or UserPrincipal.

    You can simply use the DeleteTree() method:

    DirectoryEntry dirEntry = new DirectoryEntry("LDAP path", "admin-username", "admin-password");
    dirEntry.DeleteTree();
    

提交回复
热议问题