Search code examples
c#active-directoryinsert-updatemultiple-value

Add value to "Other" property in Active Directory


Some fields in AD have a option "other" for multiple values: AD fields screenshot

I tried to add new values to this field using following code:

 if (Domaincontact.Telephones.Faxes != null)
   {
     foreach (var fax in Domaincontact.Telephones.Faxes)
       {
        if(activeDirectoryContact.Properties[FAX].Contains(fax)) continue;
            activeDirectoryContact.Properties[FAX].Add(fax);
        }
    }
 activeDirectoryContact.CommitChanges();

But after last line of code have an exception:

ExtendedErrorMessage = "00002081: AtrErr: DSID-031517FA, #2:\n\t0: 00002081: DSID-031517FA, problem 1005 (CONSTRAINT_ATT_TYPE), data 0, Att 17 (facsimileTelephoneNumber)\n\t1: 00002081: DSID-031517FA, problem 1005 (CONSTRAINT_ATT_TYPE), data 0, Att 17 (facsimileTelephoneNumber)\n"

Whats wrong with AD? ;D Can someone advice me what I missing?


Solution

  • OK. I figured out by myself. Here the link to AD fields description. In my scenario it would be:

    otherFacsimileTelephoneNumber

    and other:

    otherHomePhone otherIpPhone otherLoginWorkstations otherMailbox otherMobile otherPager otherTelephone