In C# I write...
DirectoryEntry computer = GetComputer();
computer.Properties["managedBy"].Value = null;
computer.CommitChanges();
When I make the call to CommitChanges() it throws a COM exception
A constraint violation occurred. (Exception from HRESULT: 0x8007202F)
something is wrong with setting the "managedBy" property to null, but how else do you clear the property?
The PropertyValueCollection class also has a Clear() method which should do this for you.
You could be getting the error because the property you are setting does not presently have a value in AD yet.
I never found the answer, but I used the Linq TO AD project, and it works in this case.
User contributions licensed under CC BY-SA 3.0