views:

265

answers:

2

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?

A: 

I never found the answer, but I used the Linq TO AD project, and it works in this case.

Andronicus
A: 

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.

benPearce
Accepted answer, no vote???
benPearce