The first step in creating content types is the choice of a built-in type. A built-in type identifies the source and how two content types are related.

This post is a continuation of Lesson 2 - Content Types, in which I will explain Content Type IDs and show some examples about the creation of IDs.

For those who like to check in details how things work, I recommend this reading!

Content Type IDs

There are some rules to create IDs for content types with the use of XML files.

The first step in creating content types is to choose a built-in type, which are predefined types of content types. Figure 1 shows some examples:

Figure 1 - Examples of Built-in Content Types

Each built-in type has a unique identification, indicating which built-in type it inherited from and how they are related.

By analyzing the figure above, observe the hierarchical structure of the identification of built-in types. In blue colour we have the identifiers of inherited built-in types and, in black colour is the built-in type of which it was derived. This represents a tree structure of inheritance.

In the example above the block of Figure 2 remains at "00", and the selected block in red colour must receive a GUID.

Internally, the inheritance scheme is interpreted by SharePoint in blocks (Figures 2 and 3), which facilitates the identification of the ancestor of the content type.

Base Content Type Hierarchy

Both SharePoint 2007 and SharePoint 2010 Foundation have a base content type hierarchy, in which all the content types are derived. Consider the Figure 4:

Figure 4 – Base Content Type Hierarchy

As you can see, all content types inherit from System. This content type is the sealed type and can not be edited.

The content types that belong to the group _Hidden are not displayed in the User Interface. They are for internal use of SharePoint.

You can assign content types to list items, documents, and folders. Content types that inherit from the Document site content type can be assigned only to libraries. Similarly, you can assign content types that inherit from the Item site content type only to lists. Content types that inherit from the Folder content type template can be assigned to either libraries or lists, because both can contain folders.

Obtaining Base Content Type Hierarchy Programmatically

Through a recursive algorithm, that uses the LinkedList object to create the hierarchical tree, I simulate such reading.

This is a code for purposes of exemplification only, widely used in my trainings. The code consists of 3 classes:

At the end of execution, the content displayed on the console must be the same in Figure 4 (if you did not change any content type).

Figure 5 – Console of base content type hierarchy

Finally we can reproduce the image in Figure 4 with some additional built-in types that are not contained in the documentation of SharePoint 2010 (probably because the current documentation is preliminary and subject to change).