This project is read-only.

Template Hub administrators Guide

Using Content Types

NOTE: The following is not required to use the Template Hub.
This is a pretty technical chapter, and it is only required if if you want an easy way to get metadata from your templates into your saved documents (which is a common corporate scenario). If you just want the fancy browser, you can skip this :)

To use the Content Types features of the Template Hub, you first need to have a few basic things in place:

Content Type Hub

You need a Content Type Hub configured. The Template Hub builds on top of this, and depends on the build-in SharePoint functionality for Content Type Syndication to distribute Content Types to your sites.
If you need help with that, you can check this document: Configuring the Content Type Hub - SharePoint Server 2010

Content Type distribution for existing document libraries

Enable the Content Type distribution job for document libraries. This is a Timer Job that is called Template Library Connector Content Type Association in your farm. It can be found in Central administration. Select Manage Web Applications. Click on the web application you want as target and select Manage features. From there you enable Template Library Connector Content Type Association, and it will create a Timer job with the same name. This can be controlled from the Timer Jobs page in Central Administration if desired. To remove the Timer Job simply deactivate the feature again.

This timer job works as follows:
  1. It gets a list of all content types that have been published in the Content Type Hub.
  2. It checks if the content type have been published to your site and has Document as it's base type.
  3. If the two above is true, it adds the content types to all the document libraries in your site.
This way, whenever you publish a new Content Type in your Content Type Hub, it will show up in your document libraries ready for use.
It may take up to 2h 15mins for it to be available, because of the default intervals for the timer jobs.

Content Type distribution for new document libraries

Enable the List Added event receiver on your site. This is a feature called Template Library Connector - Add published Content Types and can be found in Site Collection Features under Site Settings of your site. This feature triggers when you add a new document library to your site, and it automatically attaches all published content types to the new library, so it can be ready for use with the rest of the system.

Why are these steps important?

We want the content types and the data entered in the columns in our templates to be preserved when we save new documents to our target library. This can only be achieved if the content type we used for the template in the Template Hub also exists in the target library.
If this is true, the Office applications will use a feature called Property Promotion/Demotion to make sure the data added to the document will be mapped to the columns in your library when you save the document. This is some magic stuff that you can read about here: Document Property Promotion and Demotion

How it works

When creating a template:
  1. You create a template in the Template Library.
  2. You select a content type (a published one, mind you :) ) for the template, and assign values to the columns in the content type.
  3. Property Promotion kicks in and saves the properties you entered to corresponding properties inside the document. This means that all your content type info, properties and values are actually stored inside the document as well.

When creating a document based on a template:
  1. You create a new document based on a template.
  2. You save this document to a target library (that has the corresponding content type available)
  3. When you do this, Property Demotion will happen, and SharePoint will check if the content type specified in the document is available in the document library.
  4. SharePoint will do a "best match" for the content type, and assign the correct content type to your document, as well as copy all the properties back to the columns in your document library.


You have now achieved something pretty cool using standard features that are not widely known :)
This will not break anything that Microsoft delivers, since it uses pretty much only standardized SharePoint and Office application features, so there will be no problem with upgrades later on. We just facilitate the use of Property Promotion/Demotion for the Office applications to make a useful package for templates.
f you require more content types, Lifecycle Policies/ECM features etc. etc. on your content types, you are welcome to use that as well. we don't alter any of the default SharePoint behaviour so all other content type and document features should be happy working with the Template Hub.

Last edited Jul 4, 2012 at 2:10 PM by KjetilG, version 9

Comments

No comments yet.