I have programatically created a user in Active Directory. I want to set that user's email. I used the following code to set email address in active directory:
UserDirectoryEntry.Properties["mail"].Value = "john@gmail.com";
UserDirectoryEntry.CommitChanges();
At this point, the email address gets set in active directory properly. But the moment, i try to update another property for that user say for eg:
UserDirectoryEntry.Properties["telephoneNumber"].value = "022-2345678";
UserDirectoryEntry.CommitChanges();
After this point, the email address that we set earlier to "mail" field gets replaced with SamAccountName@domainName.com.
Can you please tell me why the email address is getting replaced with SamAccountName@domainName.com even if i have set it to "john@gmail.com". I m using APIs of Active Directory.