Active Directory defines a set of attribute syntaxes for
specifying the type of data contained by an attribute. The
predefined syntaxes do not actually appear in the directory, and
you cannot add new syntaxes. Several methods can be used to
identify the syntax of an attribute class:
Reading or writing an attribute using theIADsinterface. The IADs.Get, IADs.GetEx, IADs.Put, and IADs.PutEx methods of this
interface use the VARIANT structure to get and set the
values of an object's attributes. The vt member of this
structure is a VARTYPE value that identifies the data
type.
Reading or writing an attribute using theIDirectoryObjectorIDirectorySearchinterfaces. The methods of these interfaces use an
ADSTYPE value from the ADSTYPEENUM enumeration to
specify the data type.
Setting the syntax of a new attribute class. To specify
the syntax of a new attribute class, set the attributeSyntax
and oMSyntax attributes of an attributeSchema object.
If the value of oMSyntax is 127, you must also set the
oMObjectClass attribute. For more information, see Choosing a Syntax.
For more information about how to determine the syntax of one of
the predefined attribute classes, see the attribute reference page
in the Active Directory Schema Reference section of the Active Directory
Reference.
The following tables describe the syntaxes supported by Active
Directory and list the corresponding VARTYPE and
ADSTYPE constants. There are tables for four syntax groups:
simple data types, strings, time formats, and object
references.
The following table lists the syntax for simple data types.
Name
Description
Boolean
Boolean. For queries that include attributes of Boolean syntax
in a filter, specify TRUE or FALSE (for example, myboolattr=TRUE).
Syntax type
Value
attributeSyntax
2.5.5.8
oMSyntax
1
VARTYPE
VT_BOOL
ADSTYPE
ADSTYPE_BOOLEAN
Enumeration
Defined by the ITU. Treated as an integer in Active Directory.
An OID string, which is a string that contains digits (0-9) and
decimal points (.).
Syntax type
Value
attributeSyntax
2.5.5.2
oMSyntax
6
VARTYPE
VT_BSTR
ADSTYPE
ADSTYPE_CASE_IGNORE_STRING
String(Octet)
Array of bytes. Use OctetString to store binary data.
Syntax type
Value
attributeSyntax
2.5.5.10
oMSyntax
4
VARTYPE
VT_UI1 | VT_ARRAY
ADSTYPE
ADSTYPE_OCTET_STRING
String(Printable)
A case-sensitive string that contains characters from the
printable character set.
Syntax type
Value
attributeSyntax
2.5.5.5
oMSyntax
19
VARTYPE
VT_BSTR
ADSTYPE
ADSTYPE_PRINTABLE_STRING
String(Sid)
Octet string that contains a security identifier (SID). Use
this syntax to store SID values only.
Syntax type
Value
attributeSyntax
2.5.5.17
oMSyntax
4
VARTYPE
VT_UI1 | VT_ARRAY
ADSTYPE
ADSTYPE_OCTET_STRING
String(Teletex)
A case-insensitive string that contains characters from the
teletex character set.
Syntax type
Value
attributeSyntax
2.5.5.4
oMSyntax
20
VARTYPE
VT_BSTR
ADSTYPE
ADSTYPE_CASE_IGNORE_STRING
String(Unicode)
A case-insensitive Unicode string.
Syntax type
Value
attributeSyntax
2.5.5.12
oMSyntax
64
VARTYPE
VT_BSTR
ADSTYPE
ADSTYPE_CASE_IGNORE_STRING
String(UTC-Time)
A case-sensitive character string.
Syntax type
Value
attributeSyntax
2.5.5.11
oMSyntax
27
VARTYPE
VT_DATE
ADSTYPE
ADSTYPE_UTC_TIME
The following table lists the syntax for the time data types. If
defining a new attribute to store time values, use the
String(Generalized-Time) syntax, which uses four characters
to represent the year instead of only two. For more information and
descriptions of the GeneralizedTime and UTCTime formats, see
How To Specify
Comparison Values.
Name
Description
String(Generalized-Time)
A time string format defined by ASN.1 standards. For more
information, see ISO 8601 and X680. Use this syntax for storing
time values in Generalized-Time format.
Syntax type
Value
attributeSyntax
2.5.5.11
oMSyntax
24
VARTYPE
VT_DATE
ADSTYPE
ADSTYPE_UTC_TIME
String(UTC-Time)
A time string format defined by ASN.1 standards. For more
information, see ISO 8601 and X680. Use this syntax for storing
time values in UTC-Time format.
Syntax type
Value
attributeSyntax
2.5.5.11
oMSyntax
23
VARTYPE
VT_DATE
ADSTYPE
ADSTYPE_UTC_TIME
The following table lists the syntax for the object reference
data types.
Name
Description
Object(AccessPoint)
From X400.
Syntax type
Value
attributeSyntax
2.5.5.14
oMSyntax
127
oMObjectClass
0x2B0C0287731C00853E
Object(DS-DN)
String that contains a DN. For attributes with this syntax,
Active Directory handles attribute values as references to the
object identified by the DN and automatically updates the value if
the object is moved or renamed. For queries that include attributes
of DN syntax in a filter, specify full distinguished
names—wildcards (for example, cn=John*) are not supported.
Syntax type
Value
attributeSyntax
2.5.5.1
oMSyntax
127
oMObjectClass
0x2B0C0287731C00854A
VARTYPE
VT_BSTR
ADSTYPE
ADSTYPE_DN_STRING
Object(DN-Binary)
An OctetString that contains a binary value and a DN. A value
with this syntax has the following format:
B:CharCount:binaryvalue:ObjectDN
where CharCount is the number of hexadecimal digits in
binaryvalue, binaryvalue is the hexadecimal
representation of the binary value, and ObjectDN is a
distinguished name. Active Directory automatically updates the DN
if the object that it refers to is moved or renamed. For more
information and a code example that uses this syntax, see
Enabling Rename-safe Binding with the otherWellKnownObjects
Property.
An octet string that contains a string value and a DN. A value
with this syntax has the following format:
S:CharCount:stringvalue:ObjectDN
where CharCount is the number of characters in the
stringvalue string, and ObjectDN is a distinguished
name of an object in Active Directory. Active Directory updates the
DN if the object that it refers to is moved or renamed.