Setting Null to DirectoryEntry.Properties["Foo"].Value during user creation thows exception on CommitChanges(). - by Scott R. Chamberlain

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 754705 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 7/19/2012 9:53:18 PM
Access Restriction Public


If a DirectoryEntry has not yet been committed to the active directory setting a property to null will cause a "A constraint violation occurred." error to happen on CommitChanges(). This means you must check that any inputs you assign to a property is not null before assigning it, if it is null you must not execute the assignment.

If you are referencing a existing DirectoryEntry or you have committed the the entry to the store, assigning null works correctly.
Sign in to post a comment.
Posted by Travis [MSFT] on 7/24/2012 at 1:42 PM
Setting an attribute to null is equivalent to clearing the value of the attribute in the directory. When an object is created there is no value to clear so this results in an error. You must check for nulls during creation.
Posted by Microsoft on 7/20/2012 at 2:29 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 7/19/2012 at 10:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(