I have to delete a group from Active Directory. I have create & list users working correctly and have tried many different instances of deleting group, but none have worked. Here is my current c# code, where "path" is a string read from settings.xml successfully:
public StatusObject DeleteADGroup(string user_id, string groupName, string password, string domain){
StatusObject status = new StatusObject(ClassName);
sting domainAndUserName = domain + @"\" + user_id;
if(DoesGroupExist(groupName)){
try{
DirectoryEntry entry = new DirectoryEntry("LDAP://" + path, domainAndUserName, password);
DirectoryEntry group = entry.Children.Find("CN=" + groupName, "group");
entry.Children.Remove(group);
group.CommitChanges();
status.Successful = true;
catch(Exception ex) {
// log error handling
}
else{
status.Successful = false;
//false handling
}
return status;
}
Any suggestions or help would be greatly appreciated! I've been working on this for what seems like an eternity!! Thank you!
blskv
Loading

Answers
Know the answer? Post it. Somebody with the same question will find it here.