Remarks

Template awareness

To build your first template there are a few quirks that might arise. This section provides an overview of those sometimes-confusing issues and a quick description on how to resolve them.

Content Types deletion

When a content type is created, the SharePoint database is updated with a NextChildByte. Whenever a Content Type is deleted the NextChildeByte still retains the last value. This means that if you create a Content Type it gets a postfix 01. When you create a second and third, they get 02 and 03. If you would delete 03 and create a new content type it still gets a 04. If you would export that set the template contains 01, 02, 04 as the 03 version is deleted. When you try to apply this template, it will fail as there is a mismatch on the new site on NextChildByte and the Content Type ID’s. The only way to fix this is to add the missing Content Type ID’s as so the Next Child Byte gets updated properly.
Unfortunately, this is a downside of using CSOM and there is no technical way of fixing this properly. Each template that uses ContentTypes should thus be manually checked if CT’s have been deleted.

Document ID feature

Whenever the document ID feature is enabled, and the ContentType Hub is pushing content types make sure the Document ID event receivers are attached to any library
where the document ids should be generated.

1
2
3
4
5
6
<RemoteEventReceivers>
   <RemoteEventReceiver ReceiverName="Document ID Generator (ItemAdded)" ReceiverAssembly="Microsoft.Office.DocumentManagement, Version=16.0.0.0, Culture=neutral,  PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.DocumentManagement.Internal.DocIdHandler" EventType="ItemAdded" Synchronization="Synchronous" />
   <RemoteEventReceiver ReceiverName="Document ID Generator (ItemCheckedIn)" ReceiverAssembly="Microsoft.Office.DocumentManagement, Version=16.0.0.0, Culture=neutral,  PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.DocumentManagement.Internal.DocIdHandler" EventType="ItemCheckedIn" Synchronization="Synchronous" />
   <RemoteEventReceiver ReceiverName="Document ID Generator (ItemUncheckedOut)" ReceiverAssembly="Microsoft.Office.DocumentManagement, Version=16.0.0.0, Culture=neutral,  PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.DocumentManagement.Internal.DocIdHandler" EventType="ItemUncheckedOut" Synchronization="Synchronous" />
   <RemoteEventReceiver ReceiverName="Document ID Generator (ItemUpdated)" ReceiverAssembly="Microsoft.Office.DocumentManagement, Version=16.0.0.0, Culture=neutral,  PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.DocumentManagement.Internal.DocIdHandler" EventType="ItemUpdated" Synchronization="Synchronous" />
</RemoteEventReceivers>