5.5 Change Types for Modifying Objects

A value can be modified by placing a combination of DS_REMOVE_VALUE and DS_ADD_VALUE change records in the same request buffer. This allows the operations to be completed with a single call to NWDSModifyObject. These change types are used with the NWDSPutChange and NWDSPutChangeAndVal functions. The change type flags have subtle differences. Select the flag according to the error conditions you want reported.

Change Type

C Value

Description

DS_ADD_ATTRIBUTE

0x00

Adds the first instance of an attribute to an object. Adding an attribute requires the attribute name and value. An attempt to add an already existing attribute results in an error.

A modify operation using this flag should be preceded by a read operation to ensure that the attribute does not already exists.

DS_REMOVE_ATTRIBUTE

0x01

Removes an attribute from an object. The following conditions return errors:

  • The attribute is not present.

  • The attribute is present in the RDN.

DS_ADD_VALUE

0x02

Adds a value to an attribute. Adding values requires the attribute name and value. Attribute values inserted in the buffer following the change record are added to the specified attribute.

An attempt to add a value to a nonexistent attribute succeeds.

An attempt to add an already existing value results in an error.

DS_REMOVE_VALUE

0x03

Removes values from an attribute. Removing values requires the attribute name and value. Attribute values put in the buffer following this change record are removed from the specified attribute.

The following conditions return errors:

  • The value is not present in the attribute

  • The value is present in the RDN.

DS_ADDITIONAL_VALUE

0x04

Adds an additional new value to a multivalued attribute. The following conditions return errors:

  • The attribute does not already have a value

  • The value matches an exisiting value

DS_OVERWRITE_VALUE

0x05

Modifies an attribute value without needing to remove the old value first and then add the new value.

  • If the attribute is single-valued, deletes the old value, and adds the new value. If the old and new value are the same, eDirectory updates the value's timestamp but does not return an error.

  • If the attribute is multivalued, adds the new value, leaving the old values. If the new value already exists, eDirectory updates the value's timestamp but does not return an error.

This flag can be use to add the first value to an attribute (single valued or multivalued).

DS_CLEAR_ATTRIBUTE

0x06

Deletes an attribute. If the attribute doesn't exist, does not report an error.

DS_CLEAR_VALUE

0x07

Clears an attribute value. If the value does not exists, does not report an error.