Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Dear,

 

I'm trying to remove a user from active directory... unfortunately this doesn't work....I'm using the code below but this failes... I use the administrator as DirectoryEntry but for some reason it doesn't find the other user in it's child objects....

using System.DirectoryServicesprivate 
DeleteUserFromActiveDirectory(DataRow in_Gebruiker){   
DirectoryEntry AD = new DirectoryEntry(strPathActiveDirectory , 
                strUsername, strPassword)	   
DirectoryEntry NewUser =                   
AD.Children.Find("CN=TheUserName", "User");   
AD.Children.Remove(NewUser);   
AD.CommitChanges();   
AD.Close();
}

When I use a filter, I DO find the the child object. but then I still can't remove the user... (I think because the remove uses the same search method as the build in "Find")

 

help is more then welcome,

 

thank you,

Edited by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...