Platform SDK: Active Directory, ADSI, and Directory Services

Using the ADSI Schema

A schema defines the universe of objects that can be stored in a directory. In Active Directory™, the schema specifies what attributes a directory service object can or must have. It also specifies the value range and the syntax of the attributes and whether they support single or multiple values. In short, the schema is organized by class definitions, attribute definitions, and attribute syntax. In ADSI, the schema is collectively managed through the IADsClass, IADsProperty, and IADsSyntax interfaces.

Active Directory uses a set of schema objects to provide dynamically extensible schema management. To find out more about an unknown object, you can look up its associated schema objects. To create a new class definition or extend an existing one, you can create or extend the appropriate schema objects. Schema objects are organized in the schema container of a given directory. To access an object's schema class, use the object's Schema property (the IADs::get_Schema_ property method) to obtain the ADsPath string and use that string to bind to its schema class object. For example, on LDAP, IADsClass represents the attribute "objectClass" which contains values that identify every type of object known to an ldap server. NDS uses "object class". WinNT defines each object type directly, such as "Domain", "Computer", or "User". In all these cases, the IADsClass interface supplies methods to identify and manage the list of properties or attributes a class uses. For example code, see the IADsClass interface.

To determine attribute definitions, that is, the range of values, the syntax, and so on, you need to inspect the schema attribute objects for each property supported by the directory service object. For discussions on how to access the schema attribute objects, see IADsProperty.

If you browse a directory service directly, you probably will not find anything corresponding to syntax objects. ADSI abstracts the syntax information as necessary and lets you use IADsSyntax to identify the syntax needed to represent an object's data.