I am not able to understand why creating group in active directory as "local" for groupType doesnt work. it throws following exception :
System.DirectoryServices.DirectoryServicesCOMException (0x80072035): The server is unwilling to process the request.
while following is the code sample :
var parentEntry = new DirectoryEntry(ParentContainer);
var groupToCreate = parentEntry.Children.Add(this.AttributeType + this.Name, "group");
groupToCreate.Properties["description"].Add(this.Description);
groupToCreate.Properties["displayName"].Add(Name);
groupToCreate.Properties["groupType"].Add((int)GroupType.DomainLocalGroup); --> this line throws error.
groupToCreate.CommitChanges();
If i change from GroupType.DomainLocalGroup to GroupType.DomainGlobalGroup, everything works fine. Can any body let me know how to get rid of this problem?