Platform SDK: Active Directory, ADSI, and Directory Services

Returning Only Attribute Names

Sometimes you do a search to determine what type of information is available for a particular object. In this case, you are only interested in the attributes, not the values, of the object. To accomplish this, set the ADS_SEARCHPREF_ATTRIBTYPES_ONLY option. Specifying this option will return the attribute names without their values. However, the result set includes only those attributes that have values assigned. For example, consider an object with the following attributes:

name = James
sn = Smith
department = Empty
phone = (206) 555-0111

When the Search Attributes Only option is set, the result set includes:

name
sn
department
phone

The default is for both values and names to be returned.