Directory Services

Modifying Attributes with ADSI

ADSI provides two methods for modifying attribute data: IADs::Put and IADs::PutEx. These methods modify the data on the client-side cache. You must use IADs::SetInfo to commit the changes. SetInfo is always an explicit call.

Note  In Active Directory, multiple attribute modifications, performed as a collective in a single operation, are committed to the directory automically. For example, if you modify the sn and givenName attributes, and clear the telephoneNumber attribute of a user object, without any subsequent calls to the SetInfo method, the changes are committed when you call SetInfo. If one or more of the modifications are not allowed and therefore not able to be performed, then none of the collective modifications made to the attributes are committed during the call to SetInfo.

Put takes an attribute name and a variant parameter. You can use this method to set attributes that contain both single and multiple values.

PutEx provides control over operations on multi-valued attributes. You may append, delete, update, and clear existing values. PutEx always expects a variant array of attribute values. However, you can use this method to set an attribute with a single value as well.

PutEx uses the following control operations: