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:
Clears the attribute's value. After the operation, the attribute does not have any value.
Replace the current value (or NULL value) with these values. This is the same behavior as Put.
Append the existing value with these values. If the current value is NULL, it has the same effect as ADS_PROPERTY_UPDATE.
Delete the values that match these values. This is different than ADS_PROPERTY_CLEAR. After the delete operation, the attribute may or may not have values.