Content Type IDs
Content type IDs uniquely identify the content type and are designed to be recursive. The content type ID encapsulates that content type's lineage, or the line of parent content types from which the content type inherits. Each content type ID contains the ID of the parent content type, which in turn contains the ID of that content type's parent, and so on, ultimately back to and including the System content type ID. By parsing the content type ID, you can determine which content types the content type inherits, and how two content types are related.
Windows SharePoint Services uses this information to determine the relationship between content types and for push-down operations.
You can construct a valid content type ID using one of two convention:
Parent content type ID + two hexadecimal values (the two hexadecimal values cannot be "00")
Parent content type ID + "00" + hexadecimal GUID
One special case, the System content type, has the content type ID of "0x". The System content type is the sealed content type from which all other content types ultimately inherit.
For all other content types, you must use one of the previous methods to construct a valid content type ID.
A content type ID must be unique within a site collection.
In general, the first content type ID generation technique emphasizes brevity in that it only takes two hexadecimal digits to denote a new content type. The second approach emphasizes uniqueness as it includes a GUID to denote the new content type. Each approach is suited to certain situations.
Parent Content Type ID + Two Hexadecimal Values
Windows SharePoint Services uses this convention to generate content type IDs for the default content types that are included with the platform. For example, the content type ID of the basic content type Item is 0x01. This denotes that the Item content type is a direct child of System. The content type ID of the Document content type is 0x0101, and the Folder content type has a content type ID of 0x0120. By parsing these content type IDs, you can determine that both Document and Folder are direct children of Item, which in turn inherits directly from System, as shown in the following figure.
Using this convention, you can determine not only what content types a content type inherits from, but at which point two content types have common ancestors.
The following figure shows the relationship of the four content types discussed earlier. In each, the unique portion of the content type ID is represented by blue text.
Parent Content Type ID + "00" + Hexadecimal GUID
Windows SharePoint Services employs this content type ID generation convention when creating content type IDs for the following:
Site content types you create based on other content types
List content types, which are copied to a list when you add a site content type to that list
For example, if you have a content type with a content type ID of "0x010100D5C2F139516B419D801AC6C18942554D", you would know that the content type was one of the following:
A site content type that is a direct child of the Document content type
A list content type created when the Document site content type was added to a list
We recommend you use the GUID approach to identify any content types that are direct children of content types you did not create. Use the GUID approach if the parent content type is one of the following:
A default content type included in Windows SharePoint Services, such as Document.
A content type developed by a third party. That way, you are assured that the content type ID is unique and will not be duplicated later by the developer of the parent content type.
After you uniquely identify a content type using the GUID approach, however, you can use the first method to identify any children of that content type. The GUID used in your content type can act as a namespace for your content type. Any children based on that content type can be identified by just two hexadecimal digits. Because the maximum length of a content type ID is finite, this approach maximizes the number of allowed content type "generations".
Content Type ID Lengths
Content type IDs have a maximum length of 512 bytes. Because two hexadecimal characters can fit in each byte, each content type ID has an effective maximum length of 1024 characters.
For example, suppose you create a new content type, myDocument, based on the default Windows SharePoint Services content type Document. For the myDocument content type ID, you start with the Document content type ID, 0x0101 and append 00 and a GUID. This uniquely identifies the myDocument content type, ensuring that Windows SharePoint Services will not add another default content type later with the same content type ID (which would be possible, if you append only two hexadecimal digits). To generate content type IDs for any content types you derive from myDocument, however, you can simply append two hexadecimal digits to the myDocument content type ID. This keeps the content type ID length to a minimum, thereby maximizing the number of allowed content type "generations".
The following figure shows this scenario. The unique portion of each content type ID is represented by blue text.
For a list of the default content types included in Windows SharePoint Services 3.0, and their content type IDs, see Base Content Type Hierarchy.