Ever since my light bulb () moment with content types, I've spent a fair amount of time working out the best way to set the little guys up. Something that I've stumbled across again and again is the (negative) effect that templates can sometimes have on content types. Below I've listed some things that I wish I had known when I first starting creating content types.....
Firstly, for those of you that may be new to content types.......
A template can very easily be applied to a content type by clicking on "Advanced Settings" in the settings for the content type
Once the template has been applied, when a user selects the content type from the 'new' menu in a library the relevant template will open.
Alternatively, if you do not apply a template, then a blank document will open (the type of document that opens will vary depending on the settings for a particular library).
Tip 1: Template Format
The term 'template' can be misleading. Often SharePoint site owners mistakenly think that the template applied to a content type should be in an office template format (i.e. .dotx or .dot). However I have found that using an office template document stops the document information panel from opening properly when a user selects the content type from the new menu in a library. Therefore, when preparing your templates for use with content types it's worth saving them in a standard office document format such as .doc or .docx.
Tip 2: Legacy Properties
Quite often template owners will copy someone else's document (i.e. using the 'Save As') and use the copy to create a template. This is very common – why not? It saves time right? There is absolutely nothing wrong with doing this as long as when preparing the template for use with content types the document is checked for legacy properties. You may like to spend some time reading my post about The Importance of Document Properties which outlines the effect legacy properties have on search results in SharePoint.
If we have a document with values in the document properties, just like the screen shot below
And we use this document as a template for our content type without first removing the properties, then whenever a user selects the content type from the 'new' menu, these properties open with the template. If the user doesn't check the properties (and often they don't), then the metadata for this type of content is incorrect and this starts to play havoc with your search results.
A very simple step to ensure that your template is free from legacy properties is to inspect the document for hidden metadata and other information. To inspect an office document:
Open the template and click on the office button in the top right hand corner of the screen
Select "Prepare" → " Inspect Document"
Click on "Inspect"
If document Properties are found, select to "remove all"
Your document should now be free of any properties which may affect the content type
Tip 3: Legacy Content Type IDs
Something I certainly wasn't aware of when I first started using content types is that whenever a document is created / uploaded into SharePoint and a content type is selected, a 'Content Type ID' is inserted into the advanced properties of that document. Just so you know I'm not lying, try adding a new document into a SharePoint library and apply a content type. Then:
In the document information panel (DIP) at the top of the document, open Advanced Properties
Select the Custom tab and you'll notice that the Content Type ID is listed here
This ID stays with the document. Even if you download the document onto your desktop, the ID comes with it. This is not normally a problem; in fact it is quite useful - if we move documents from one location to another, the ID helps the document to remember what type of content it is. The only time this is a problem is if we try to use a document that has a content type ID as a template.
If we happen to do this (as I have done) then the content type starts to get very confused and starts to misbehave at the library level (i.e. it affects your users). Once again, it's very simple to ensure that this type of thing doesn't happen. Just run the document inspection tool (see tip 2) on your proposed template and remove any hidden metadata before applying it to the content type.
Tip 4: Be careful when using the 'Enter the URL of an existing document template' option
You might have noticed in the advanced settings of a content type, that there is an option to enter the URL of an existing document template.
I was really excited about this idea when I first saw it. I thought it meant I could store the document template in a library in the template owner's site. They could then freely update the template whenever they like and this would automatically update all libraries and lists using that content type. It meant I wouldn't have to give the template owner permission to modify content types, hence giving them permission to other settings that I probably didn't want them to touch.
Unfortunately, I think this idea still needs a little work..... let me show you what I mean
I have created a content type called 'My Company Report' and I have applied metadata columns of:
- Date Written
- Brief Description
The next step is to create a library somewhere in SharePoint where you will store all your templates that will be applied to the content types. In this example, I have created the library in the top level site and called it 'Templates'.
I then apply the 'My Company Report' content type to that library
Now I upload the 'My Company Report' template into the library and I tag it with the content type 'My Company Report'. I leave the remaining fields empty.
I then copy the URL of the My Company Report template
Back in the advanced settings for 'My Company Report' content type I paste the URL of the template into the relevant field and say ok.
So far so good…..
Now my content type, with relevant metadata and template is ready to be pushed out through my site collection. I go to a library somewhere in my site collection (in this example I'm using a library called 'reports) and apply the My Company Report content type to the library
Now it looks like it's ready to use…. So go ahead and click to create a new My Company Report… Looks like everything worked perfectly hey? DIP opened, the document saved into the correct library, there were no errors…. In fact, yes, this method does work perfectly… until, we add in mandatory list columns.
Now, in this particular reports library, my users would like to also capture the 'Project Name' against each report when saved. They only want to do it in this library and not for any other reports saved elsewhere in the site collection. So it makes sense that we would just apply the list column to this particular library and not to the content type itself.
So I go into the library and apply a new column called 'project name' – make the column mandatory. Everything seems ok….
Now I create another new My Company Report… and looks as though everything worked ok again… however if you pay particular attention to the document information panel you'll notice that there is something missing…
The 'Project Name' field you created is not there.
Go ahead and try to save your document - you'll probably get a similar error message like the one below
So why does this happen? When a user creates a new document from the new menu in the 'Reports' library, the settings from the template (the one saved in your central 'templates' library) overrides the settings on the 'reports' library. Then when the user saves the document, the settings from the Report library are applied and this is what causes errors, things not to appear on the DIP when they should etc etc.
This blog is long enough so I'm not going to go into any more detail but if you have a play I'm sure you'll discover some other short comings with this method.
So overall, when you are preparing your templates for use with content types, make sure you check these few things:
- Use the correct template format (i.e. .doc or docx)
- Scan your template for any legacy properties
- Be careful when using the 'Enter the URL of an existing document template' option