Saturday 25 July 2009

Content Type ID Structure

Creating a custom content type in a feature requires you specify the ID attribute.

Content type IDs are constructed hierarchically and you can trace the lineage of a content type through its ID. A custom content type will often derive from the Item content type—the most basic content type you can use. Item is derived from the System content type and contains the ever-present Title field (Title can be hidden if necessary). Note the System content type is sealed, meaning it can’t be derived from in your code.

The ID of the System content type is 0x and the Item content type appends 01, giving you 0x01. A separator must be used between all subsequent IDs appended to the base string; 00 is used for that purpose, giving you 0x0100.

A custom content type will need its own ID appended to the base system-item-separator ID and the best way to do that is using a GUID without the braces and hyphens (use guidgen.exe, included with Visual Studio).

Here’s an example with the base system-item-separator ID combination bolded for clarity:


To create additional custom content types derived from an existing custom content type, add an addition separator and GUID:


Content type IDs are limited in length to 1024 characters so if you’re running out of room or just don’t like using GUIDs, a content type ID can optionally be specified with two digits other than 00. WSS uses this convention so be wary of any clashes with your own custom content types.

If you’re working with pages, note the Page content type derives from System Page content type, which in turn derives from Document which in turn derives from Item. The Page content type ID is therefore


Additional Resources:

1 comment:

  1. Use can also use SPSource...create the Content Type in the UI and then just reverse engineer the results ;-)


Spam comments will be deleted

Note: only a member of this blog may post a comment.