I'm trying to add two different external email addresses for the contacts in the Active Directory. I'm facing the following COMException
: A constraint violation occurred.
Here is the DirectoryEntry path= "LDAP://CN=s0010109,OU=RSVContacts,DC=domain,DC=com"
Here is the code :
DirectoryEntry entryAD = new DirectoryEntry("LDAP://CN=s0010109,OU=RSVContacts,DC=domain,DC=com")开发者_如何学Go;
DirectorySearcher myADSearcher = new DirectorySearcher(entryAD);
SearchResultCollection resultAD = myADSearcher.FindAll();
entryAD.Properties["targetaddress"].Value = new string[] { "SMTP:" + "firstemail@abc.com", ""SMTP:" + secondemail@mail.com"}; //;
entryAD.CommitChanges();
Like what I said in my answer on your previous question, targetAddress
is not a multi-value attribute. You cannot do that. You can only have one single value stored in this attribute.
精彩评论