Platform SDK: Active Directory, ADSI, and Directory Services

Defining a New Class

When you define a new class, you need to specify the legal parent classes of your new class, that is, the classes that can contain instances of your new class. The legal parent classes are specified in the possSuperiors and systemPossSuperiors attributes of the new class, as well as in the possible superiors inherited from its superclasses (but not from auxiliary classes).

Be as specific as possible when defining the legal parent classes for the new class. Where do you want users to be able to create instances of your class? For example, specifying "container" as a legal parent will let the user create instances under any of the standard containers (container, organizationalUnit, and so on), while specifying "computer" would allow instances to be created only under instances of the computer object.

To Create a Class

  1. Choose a name for the class. For information on composing a common-name and an LDAP display name for a new class, see Naming Attributes and Classes.
  2. Obtain an object identifier (OID) for the class. See Obtaining a Root Object Identifier (OID).
  3. Choose a "default object category" for the class. See Object Class and Object Category.
  4. Choose an "object class category" for the class. This indicates whether the class is abstract, structural, or auxiliary. See Structural, Abstract, and Auxiliary Classes.
  5. Create a new classSchema object. There are a large number of attributes that can be set for an classSchema object. The following attributes are critical to the definition of a new class. For descriptions of these attributes, see Characteristics of Object Classes.

    Note that the classes specified in subClassOf, possSuperiors, systemPossSuperiors, auxiliaryClass, and systemAuxiliaryClass, must exist when the new class is written to the directory; otherwise, the classSchema object will fail to be added to the directory. Similarly, the attributes specified in mustContain, systemMustContain, mayContain, and systemMayContain, must exist or the class creation operation will fail.

  6. Write the new classSchema object to the directory.

To add an attribute to the mayContain property

  1. Retrieve the classSchema object for the class you want to modify
  2. Add the new attribute to the mayContain multi-valued property
  3. Write the changed classSchema object back to the directory.