Dear,
Im trying to remove a user from active directory... unfortunately this doesnt work....Im using the code below but this failes... I use the administrator as DirectoryEntry but for some reason it doesnt find the other user in its child objects....
When I use a filter, I DO find the the child object. but then I still cant 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,
Im trying to remove a user from active directory... unfortunately this doesnt work....Im using the code below but this failes... I use the administrator as DirectoryEntry but for some reason it doesnt find the other user in its child objects....
C#:
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();
}
help is more then welcome,
thank you,
Last edited by a moderator: