Platform SDK: Exchange Server

Deleting Object Attributes

You can delete attributes from objects using the BatchImport or DAPIWrite function. To do this, specify the object class, the name of the object, and use the string ~DEL in the column specified for the attribute. This should not be in quotation marks. If in quotation marks, the value will be taken literally, and the string "~DEL" will be put into that attribute.

For example, the following lines appear in an import file. The first line is the header line. The second line creates or modifies a mailbox. In this example, the attribute Comment is being deleted from the user Steve Masters:

Obj-Class,Common-Name,Given-Name,Surname,Display-Name,Comment
mailbox,SteveMas,Steve,Masters,Steve Masters,~DEL
 

It is possible to reset the attribute later by running the import operation again and specifying a value. For example, the data line in the following example resets the Comment attribute for this user to the value 'Hello'.

Obj-Class,Common-Name,Given-Name,Surname,Display-Name,Comment
mailbox,SteveMas,Steve,Masters,Steve Masters,Hello
 

Another use for this functionality is to remove a recipient from all distribution lists for which it is a member. To do this, specify ~DEL in the Members column. If the object you are modifying is a distribution list, specifying ~DEL in the Members column deletes all the members of the distribution list. To delete a distribution list from another distribution list, use the Administrator program.

This string can be specified in upper- or lower-case letters (~DEL or ~del).

Note  Merely omitting a value in a column in a .CSV file does not delete an attribute. If, for example, you use ,, (no value specified between the separator characters), this column is ignored for that object, so the attribute's original value is maintained. This is why ~DEL must be used to delete an attribute.