How do I update the managedBy property on a computer object in Active Directory?

0

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?

c#
active-directory
asked on Stack Overflow Aug 20, 2009 by Andronicus • edited Oct 26, 2009 by Jeremy Stein

2 Answers

1

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.

answered on Stack Overflow Sep 11, 2009 by benPearce
0

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

answered on Stack Overflow Aug 26, 2009 by Andronicus

User contributions licensed under CC BY-SA 3.0