大网数据广告活动
域与目录服务

Defining a New Class

· 52CE 我爱测

When you define a new class, specify the legal parent classes of the new class, that is, the classes that can contain instances of your new class.

When you define a new class, specify the legal parent classes of the 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 specific when defining the legal parent classes for the new class. Decide where you want users to create instances of your class. For example, specifying "container" as a legal parent will enable the user create instances under any of the standard containers (container, organizationalUnit, and so on), while specifying "computer" would enable instances to be created only under instances of the computer object.

To Create a Class

  1. Choose a name for the class. For more information about 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. For more information, see Obtaining an Object Identifier.

  3. Choose a "default object category" for the class. For more information, 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. For more information, see Structural, Abstract, and Auxiliary Classes.

  5. Create a new classSchema object. Many attributes can be set for an classSchema object. The following attributes are critical to the definition of a new class:

    • Classes from which the new class inherits: subClassOf, auxiliaryClass, and systemAuxiliaryClass
    • Names and identifiers for the new class: cn, lDAPDisplayName, adminDisplayName, schemaIDGUID, governsID
    • Possible attributes of the new class: mustContain, systemMustContain, mayContain, systemMayContain
    • Possible parents of the new class: possSuperiors, systemPossSuperiors
    • objectClassCategory
    • defaultObjectCategory
    • defaultHidingValue
    • rDnAttId
    • defaultSecurityDescriptor
    • description (optional)

    For more information, and descriptions of these attributes, see Characteristics of Object Classes.

    Be aware 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. Obtain the classSchema object for the class to modify.
  2. Add the new attribute to the mayContain multi-valued property.
  3. Write the changed classSchema object back to the directory.

New attributes can be created at the same time as new classes; the order of creating the new attributes and classes is important. For more information, see What the Installation Must Do.

To add new attributes and new classes at the same time

  1. Define all of the new attributes first. For more information, see Defining a New Attribute.
  2. Update the Schema Cache before defining any new classes. For more information, see Updating the Schema Cache.
  3. Create the new classes.
  4. Add the desired attributes to the new classes.
  5. Update the Schema Cache again.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。