Directory Services

Finding a List of Attributes To Query

If you are searching for objects of a particular class, the comparisons in your search filter should specify attributes that actually exist on the objects of that class. To get the list attributes on an object of a particular class, bind to that class in the abstract schema and call both IADsClass::get_MandatoryProperties and IADsClass::get_OptionalProperties to get the list of all properties for that object. For more information, see Reading the Abstract Schema.

In addition, all objects inherit from the top abstract class. Therefore, any attribute in top can exist (although it may not be set) on any object.

If you are searching the global catalog, ensure that you specify attributes in the global catalog. Attributes included in the global catalog have the isMemberOfPartialAttributeSet set to TRUE on their attributeSchema objects. Be aware that this information is not available in the abstract schema; read it from the attributeSchema object in the schema container.

In the global catalog, a back link attribute can be queried only if both of the following conditions are met: First, the attribute is marked for inclusion in the global catalog and second, the corresponding forward link is also marked for inclusion in the global catalog. This applies to query filters as well as query results. For more information, see Linked Attributes.

In addition, some attributes (mostly on the user object) are constructed. Query filters cannot contain constructed attributes. Constructed attributes cannot be evaluated in query filters; however, they can be returned in query results. This applies to all the naming contexts and the global catalog. Attributes that are constructed have ADS_SYSTEMFLAG_ATTR_IS_CONSTRUCTED (0x00000004) in the systemFlags property on their attributeSchema objects.

Note  You can get information about the predefined classes and attributes that ship with the system from the reference pages in the Active Directory Schema Reference in the Active Directory Reference. These pages list the mandatory and optional attributes of each object class. For attributes, the reference page indicates whether the attribute is indexed, constructed, linked, or in the global catalog.