Hi guys,
I have found interesting code..
Unfortunatelly I dont know how to use it :/
public void Delete(string ouPath, string groupPath)
{
if (DirectoryEntry.Exists("LDAP://" + groupPath))
{
try
{
DirectoryEntry entry = new DirectoryEntry("LDAP://" + ouPath);
DirectoryEntry group = new DirectoryEntry("LDAP://" + groupPath);
entry.Children.Remove(group);
group.CommitChanges();
}
catch (Exception e)
{
Console.WriteLine(e.Message.ToString());
}
}
else
{
Console.WriteLine(path + " doesn't exist");
}
}
I don't know whats the difference bewteen ouPath and groupPath
At first I thought that
groupPath is
LDAP://CN=GRUPA TESTOWA,OU=Security,OU=Groups,OU=Krakow,OU=PL-PMPL,OU=PMI,OU=Users & Workstations,DC=LORDAC,DC=NET
and ouPath is:
LDAP://OU=Security,OU=Groups,OU=Krakow,OU=PL-PMPL,OU=PMI,OU=Users & Workstations,DC=LORDAC,DC=NET
But it doesnt work...
I need to delete group and I really dunno how to modify that code :/
Can you help me?
Thanks in advance!