Defining a New Attribute
Consider the following before defining a new attribute:
- Use existing attributes wherever possible.
- Always use "common name" (cn) as the naming (RDN) attribute—this is the default for most classes, including those derived directly from Top. CN is an indexed attribute and will make searching for your object by name efficient.
- Large multi-valued attributes are costly to store and retrieve and should be avoided. Active Directory implements an LDAP extension to allow incremental read of large properties with multiple values, but not all LDAP clients will know how to use this extension.
- Remember that attributes are "flat", that is there is no implied substructure to an attribute. All attributes in a given class should relate directly to instances of that class.
To Create a New Attribute
Follow these steps to create a new attribute:
- Choose a name for the attribute. For information on composing a common-name and an LDAP display name for a new attribute, see Naming Attributes and Classes.
- Obtain an OID for the attribute. See Obtaining a Root Object Identifier (OID).
- Choose a syntax for the attribute The syntax is determined by the combination of oMSyntax and attributeSyntax. See Choosing a Syntax.
- Decide if the attribute is single or multi-valued
- Decide if the attribute should be indexed by default.
- Decide if the attribute should be in the global catalog by default.
- If the attribute is an integer or string, decide if a range limit is needed
- If the attribute is DN-valued, decide if the attribute should be linked with another attribute. If so, the linkID property must be set appropriately on each attribute (one attribute must be a forward link, the other a back link). The schema extension program must use an available set of link IDs. See Example Code for Finding the Next linkID.
- Create a new attributeSchema object. There are a large number of attributes that can be set for an attributeSchema object. The following attributes are critical to the definition of a new attribute. For descriptions of these attributes, see Characteristics of Attributes.
- Name attributes: cn, lDAPDisplayName, adminDisplayName
- Syntax attributes: attributeSyntax, oMSyntax, oMObjectClass
- schemaIDGUID
- attributeID
- isSingleValued
- searchFlags
- isMemberOfPartialAttributeSet
- Optional range attributes: rangeLower and rangeUpper
- linkID—Optional. Required for linked attributes.
- description—Optional
- Write the new attributeSchema object to the directory.
- Update the schema cache if necessary.