SharePoint Problem Solved: Amnesia Problem: Multiple Content Types on Libraries
Guest Author: Nick Grattan
Nick Grattan Consultancy Limited
http//nickgrattan.wordpress.com
In this blog post I describe a problem whereby document libraries having multiple content types use the default content type when documents are saved regardless of the selected content type.
Well, thanks to Kevin at Dublin City Council, (that’s Dublin, Ireland) here’s a solution to this problem. It’s all to do with how you define the template for the content type using “Advanced Settings” for a content type:

First, if you “Upload a new document template” the problem described above does not occur. The correct content type will always be selected regardless of how many content types there are associated with the document library. However, your document template is not under version control and becomes more difficult to update using this option.
I normally use the “Enter the URL of an existing document template” and add the URL to a document library containing content type templates (let’s call it “Content Type Templates Library”). That way, if the content type template is updated in this document library the new version will immediately be used. This is the situation where the wrong content type will be selected.
To solve the problem (and this is where Kevin comes in), you need to associate the content types with the “Content Type Templates Library”. The documents representing the content type templates need to have the content type they are being used in. Let me give an example:
Say you’ve got two content types: “CT1″ and “CT2″ and these use document templates called “DT1.doc” and “DT2.doc” respectively. The documents “DT1.doc” and “DT2.doc” are stored in a document library called “Content Type Templates Library”. Now, you need to associate content types “CT1″ and “CT2″ with “Content Type Templates Library”. Further, “DT1.doc” must use “CT1″ and “DT2.doc” must use “CT2″.
Once this has been setup, the content types “CT1″ and “CT2″ can be associated with a document library in which users will create documents. Now, new documents created by users will have the correct content type associated with them.
Guest Author: Nick Grattan
Nick Grattan Consultancy Limited
http//nickgrattan.wordpress.com
Nick Grattan is an expert on Microsoft SharePoint development, administration and workflow process engineering. He is an experienced Microsoft .NET application architect and designer and delivers many very successful workshops on new and emerging technologies such as Windows Workflow Foundation and Microsoft Office SharePoint Server 2007. Nick, is a director of Nick Grattan Consultancy Limited, was the Microsoft MSDN Regional Director for Ireland from 1997 to 2008, and has clients all over Europe. Nick is the author of several books including “Windows CE 3.0 Application Programming” (Prentice Hall PTR, 2000), “Pocket PC, Handheld PC Developers Guide with eMbedded Visual Basic” (Prentice Hall PTR, 2002) and “Windows CE Development for Dummies” (John Wiley & Sons Inc, 1998); many articles for publications such as the “Developer Network Journal” and white papers for Microsoft Corporation.













Can you include screen shots with this? The tutorial isn’t that clear.
Can you please elaborate on the solution? I am having this issue, but this post doesn’t provide details on how to resolve.
Hello,
I am having this issue and this did not help. The article is not absolutely clear at the first glance, but if you think about it, you will understand. However, I tried adding those content types to a standalone library, assigning them to the proper CTypes and using them as templates, as you recommend, I tried uploading the templates (you write this does not occur in that case), but the newly created documents still get only one (or no) content type. What is strange, it works in the top-level site correctly, but in a particular subsite not.
The documents seem to be getting the content type that is set as the first (default) one.
Really don’t know what’s going on there :-/
Any ideas?
I think I have understood what you mean and did manage to get my templates to work in different libraries, however it falls over when you need required fields.
Please correct me:
1. Create ‘Content Type Templates Library’ and upload the templates into that library (CT1.doc/CT2.doc)
2. Create Content types to work off these documents (URL reference)
3. Go back to the ‘Content Type Templates Library’ and assign the content types to that library (Settings)
4. Edit the properties of each document (CT1.doc/CT2.doc) and assign it to the relevant content type (will be set to document by default)
5. Create new document library elsewhere and add the content types
6. Create new document and the correct columns will appear.
All of the above worked, however it falls over when you have ‘Required’ fields as you cannot update the original CT.doc template wtihout adding the required fields as it is now based on it!
Please let me know if I have misread?
Works great for optional fields though.
Have the same experience as Marek. It does not even work when using the option of uploading a new document template and also it seems like it is the first (default) content type that are used as a default value valude for the column Content Type when checking in a document even if another was initially chosen (with the NEW command). This is very annoying for the users, first selecting the content type needed and then be forced to select that again when checking in the document (if lucky to realize that it has been changed internally.
Do I understand Your instructions wrongly. I cannot really understand how You can state that the upload new template option actually works. Does it have something to do with on what site level we are testing as Marek states?
I have opened a case with Microsoft. They say it is a language pack problem (German, French, Czech), but I am not convinced about it. There is no result so far anyway (for about two weeks).
I assume it may be connected to a web site template, that has been used few times (when a site template is created from a subsite, it carries the custom content type definitions, but they are not present/configurable in the newly created site based on that template).
I will post an update as soon as I get some results.
Keep fingers crossed :)
Marek
I’m struggling with this problem, too. My observations are a bit different because I’m creating content types and uploading document templates using the SharePoint web services (Lists.asmx and Webs.asmx). Here’s the sequence of web service calls in “pseudocode”
1. siteCT = Create site content type with documentTemplateURL
2. listCT = Apply site content type to docLib
3. documentTemplate = Upload file to documenttemplateURL in docLib
4. Set content type of documentTemplate to listCT
After that, the content type of the document template will be displayed as listCT. However, when I create a document from this template, the first content type in the drop-down list (usually “Document”) is preselected in the save dialog.
When I execute step 4 manually (not using the web service), everything is fine and “listCT” is preselected in the save dialog.
Hi again!
After putting together different tests performed we have ended up with the following table
Sharepoint Office Templ format Result
2007 2003 .dot NOT successful
2007 2007 .dot NOT successful
2007 2007 .dotx Not tested, will be tested next week :-).
2007 2010 Not available environment
2010 2003 .dot NOT successful
2010 2007 .dot NOT successful
2010 2007 .dotx SUCCESSFUL
2010 2010 Not available environoment
Could it be that this is a Office version problem and specifically a document format problem (XML format needed)? This due to the solution/desing chosen by Microsoft when building this module. If so I doubt we will get a solution by Microsoft, now with Sharepoint 2010 coming and that they would like us to use Office 2007 and upwards instead and especially the new .XML format (.dotx et cetera).
When the DIP is used in Word the Content Type is not shown as a field but looking at the document properties in Sharepoint afterwards confirms the different results.
/Stefan
Hi Stefan,
I was able to resolve the issue with this hotfix:
http://support.microsoft.com/kb/976393/
The content type that is preselected when saving in Word is written into the template file by SharePoint (save the Word document locally and search for the content type name with a hex editor). This means that this problem always occurs with file types that don’t support storing the SharePoint content type in some kind of metadata (for example, RTF)
Hi ndeuma,
I have to say that this did not help me, I had tried it before I contacted Microsoft. The issue may be somewhere else as well.
MS has not provided any solution so far (3 weeks).
Marek
Have worked on this problem a few more hours and been in contact with MS as well. Eventually we came up with the following solution (workaround?). It seems like it works differently dependant on what Office format used.
If using a non XML format i.e. for example .dot, .xlt and .pot it does not work correctly when chosing a Content Type other than the first one with the NEW command. But when using a XML format like .dotx, .xltx or .potx it works.
Also we found out that if using an already stored document as a source for a new document, i.e. not using the NEW command but instead EDIT an old document and then saving it as a new document (SAVE AS), then it works. You get the correct Content type as default value when checking it in. This was the trigger to how we found a solution at least good enough for us for the moment. We found out that a document property with the name ContentType had been created with desired value (the one used when checking in).
The solution/workaround as follow: For each template (.dot /.xlt / .pot) that You are going to map to Your Content Types within Your Document Library add a document property (in the Custom tab) named ContentType and add the value of the content type to be. Important to use the same value as the one You use within the Document Library for the corresponding Content Type. This can be done either by opening the document and then use the File / Properties menu choice or by right clicking directly on the file using Windows Explorer and then select Properties.
When this is done perform a new mapping between the document template and corresponding content type within Your document library (Document Library Settings –> select Content Type –> Advanced Settings ). Now the system will use the value stored in this ContentType property as default value when checking a document in that have used this template.
Note 1: Have only tested on Office documents but probably this is the only ones to be used directly form the NEW command.
Note 2: The reason that one sometimes read that it works now and then for people could be that sometimes one uses a ‘template’ when mapping that already (of some reason) includes the ContentType property. For example as described above using an ‘old’ document as template earlier checked in with the correct value.
Note3: Our MS contact suspect the problem could be a result of decided design for Office 2003 documents (.dot et cetera), not necessarily a bug. Sharepoint has no way of knowing which content type it is and instead behaves as if You are Uploading a document. He also refers to the article http://msdn.microsoft.com/en-us/library/bb447539.aspx where it is explained how it works for the Office Open XML format.
I hope this could be a solution for some of You out there…
/Stefan
Hi Stefan,
I tried that; I use docx files (Office 2007). Did not help. I am still providing more information to MS with no relevant solultion so far. They suspect it has something to do with the language pack (Czech, in our case).
And the best thing is that to reproduce the problem we only had to change the content type sorting in the doclib. And no way back so far.
Marek.
If i want to associate multiple Content Types to a document library through feature/wsp/solution package then how is it possible.
Santosh – Sorry, we don’t handle development questions here. You’ll need to try SharePointDevWiki.com and see if Jeremy can help. — Mark