Tag: parent

SharePoint Content Type ID GUID’s – Parent and Child

If you are looking to work with Content Types in SharePoint programmatically, you should understand the naming conventions used to compose the ID’s.

A content type’s ID shows inheritance. This is based on string concatenation with ’00’ as the seperator. This is generally in the form ‘0x[baseID]00[GUID (new id)]00[and so on]‘.

As an example, the ID of the built-in content type Item is 0x01. When inheriting from it, an example custom content type would be 0x010100E0D3BD7003DA22419C52027ABF151.
You will notice the custom content type ID starts with the ID for Item (0x01) followed by the ’00’ separator and then the GUID assigned to this content type.To find the parent of any content type, all that is needed is to split that content types ID on the separator ’00’ and examine the inheritance chain.

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 detailed in the previous diagram. In each content type, the unique portion of the content type ID is represented by blue text:

PowerShell can be used if you don’t have a development tool to look Content Type ID’s automatically. Below is a PowerShell script to get you the IDs of all content types on a site:

$site = Get-SPSite http://mysite.myfarm.com
$web = $site.RootWeb
ForEach($ctype in $web.ContentTypes){write-host $ctype.Name": "$ctype.ID}
Sample Output:

Content Type ID’s – MSDN:
Content Type Element (ContentType) – Technet:
Standardize Data Management with Content Types: