Nov 07, 2014
When it comes to the creation of content types within SharePoint 2013, you should know what to inherit from an existing content type, be it either a built-in content type or an existing custom content type. When we look at this content type through a developer’s eyes, we are working with the content type element. This element exposes no indication of the inherited parent content type, instead we can retrieve information about the inheritance by looking at the Content type ID. We shall call ours “DemoContentType” The following is an example of a content type ID:0x010400bd581d9f8d2f4bb9b7664bab444714efWhen we need to read the Content Type ID, we can split it up into three parts. The first part of the ID will represent the parent Content Type ID, in our case it is: “0x0104” This value indicates 3 pieces of information. First we have the “0x” that represents the system, next we have “01” that represents an item and lastly we have “04” that represents a document. In short, we are deriving our content type from the document content type provided by SharePoint. The second part of the Content Type ID is the following:
00This is called a spacer and it divides the Parent ID from the current Content Type’s ID. The last part of the Content Type ID is:
bd581d9f8d2f4bb9b7664bab444714efThis value is in the Global Unique ID of the content type that you are working with, each content type within your SharePoint environment will have a unique ID value that identifies the object. Also by using this approach, you can ensure that SharePoint won’t add another Content Type ID with the same value. When you have created your content type, you can now create additional content types that derive from your custom content type. When you have this requirement, you have to perform some steps to make sure the new content type has the correct ID. Step one: make sure you append a spacer to the existing Content Type ID (as shown in bold):
0x010400bd581d9f8d2f4bb9b7664bab444714ef00Step tw:, append the new GUID of the content type (as shown in bold):
0x010400bd581d9f8d2f4bb9b7664bab444714ef00a1f3d826a2764228a68f9b15abe9c373This now represents the child content type that was derived from “DemoContentType”. This allows you to create multiple derived content types, but also makes it longer with each child that you create. This poses an issue because any Content Type ID can only be 1024 characters long. To overcome this issue we can use the shorthanded way when creating a new child content type, in this method you just append two hexadecimal digits to the parent Content Type ID. The conclusion in doing this is that you don’t end up with an ID such as: “0x010400bd581d9f8d2f4bb9b7664bab444714ef00a1f3d826a2764228a68f9b15abe9c373” But with an ID that looks like this:
0x010400bd581d9f8d2f4bb9b7664bab444714ef05By following this method, you end up with short IDs and you can have more generations of content types.
How do your Excel skills stack up?
Test NowNext up:
- How to create a template in Microsoft Outlook 2010 and 2013
- Active Directory Administrative Center (ADAC) Updated
- More haste, less speed
- Using Delegates in .NET
- Charts that aren’t charts
- Control your digital world from your mobile device
- Using SharePoint to create a ‘Team Based Master Calendar’
- Deliver successful organisational transformation
- Removing the background from a picture in Microsoft Office
- The Windows Server 2012 R2 Desktop Experience
Previously
- Evolving Office 365 plans
- Killer Fillers
- Duplicate animations with ease using PowerPoint’s Animation Painter
- SQL Server in Microsoft Azure virtual machines
- Doing a VLOOKUP that finds exactly what you want
- Designing business continuity management strategies in SharePoint 2013
- Taking the emotion out of feedback
- Use Office 2013 at home with an Office 365 subscription
- Extension methods in C#
- Use the master slide to save time in PowerPoint 2013