Having Content Types with Document Templates when using "New Document”

If you have document library with more than one content type with a document template in there and you use the “New Document” button to create new documents you might run into some unexpected behavior.

In order to explain what happens I created two content types ContentType1, and ContentType2. Both have the Enterprise Keywords field added to it, so they have something to show in the document panel later on, but this doesn’t have anything to do with the unexpected behavior. Both content types also have a document template, the document template for ContentType1 is DocumentTemplate1.dotx and is saved in a Document Templates library in the same site, the document template for ContentType2 is DocumentTemplate2.dotx and is saved in the same library. For adding the document templates I used the “Enter the URL of an existing document template” option.

Document Template

I have a document library called Shared Document where I added both the content types. I can now add documents to the library by using the “New Document” button and choosing on of the content types.

Document Library

I don’t add any special content to the document, I just create a new document and save it back to the library. If the SharePoint site you’re on is not in your trusted sites you will have to “Enable Editing” because Word will detect that the template you are opening is stored on an internet site. Also be aware that Word will try to save the document to wherever you last saved a document. So it won’t automatically select the library you were working in for you, you might have to browse to that library yourself.
As you can see from the image below both document have the Document content type attached to them, instead of the ContentType1 and ContentType2 content types that I selected when I created the documents. So regardless of what content type you use to create the document, SharePoint will pick a content type for you to save the content type as. This doesn’t have to be the “Document” content type, or the default content type of the library you’re working in. SharePoint will just pick the wrong content type for you.

Documents Wrong Content Type

As far as I’m concerned this is a bug. However there is a workaround…

I’m going back into the content type and I’m going to add the document templates again, but this time I will use the “Upload a new document template” option. I can select the document to upload either from my harddisk, or from the Document Templates library I used earlier. I can also use the same template for both content types, this doesn’t affect the workings.

Document Template2

After you saved the changes to the content type the link to the document template will be displayed like this:

Document Template3

If I now create new documents the same way I did before, by using the “New Document” button and selecting a content type from the list, the documents will be saved with the correct content types.

Document Library2

Comments -
  1. Gravatar

    Hi Mirjam,
    This is not a bug but a feature in SharePoint. The reason is that I think that you have missed one step in the end. The document library in which you have uploaded the docs in the section "Enter the URL of an existing document template" are in fact also documents that are based on a content type. What you have to do is this.
    1. Go to the document template doclib where you have put the two .dotx files which you use in your shared documents example
    2. In the doclib settings, advanced settings, enable "Allow management of content types?"
    3. In the Content type section, choose "Add from existing site content types" and select your 2 documentteplate.dotx files.
    4.Now go back to your doclib. Choose the the first In the documenttemplate, in the pull down menu, choose "Edit properties" of the Word document"
    5. In the pull down 'Content Type' you can select the 'content type'. Assign not the default Document content type but let him point to himself.
    6. That's it.

    SharePoint will now remember that this dotx is pointing to himself. When you now go to you shared documents doclib and you create a New Document and select the ContentType1, it will indeed create the correct document template and not the default 'document' content type. And is will also now open in the Document information Panel your extra meta data. This works both in Moss2007 and SP2010. I hope this is a bit clear. Unfortunately I cannot upload any screenshots to make it more clear.

  2. Gravatar

    I believe Peter is correct.

  3. Gravatar

    Hi Peter,

    Thanks for sharing. I never thought about trying that. Your solution sounds like another possible workaround to me. It will work if you have a different templates for each content type and you prefer to link to a document template, but not when you want to use the same document template for all content types.

    Either way we now have two ways to work around it.


  4. Gravatar

    That workaround seems to work for Documents, but what about Pages? I have several new Content Types all based on the Article Page Content Type. Whenever I create a page based on any of my custom Content Types, I am left with a page that is of type Article Page.

    I tried to grab the CreatePage.aspx page from /_layouts/ and upload it as the custom template, it didn't work.


  5. Gravatar

    Hi, I follow the above scenario. When saving a newly created document, I have to choose which of the 2 content types I want to use. Is that by design?

  6. Gravatar

    Hi Peeter,

    If you have more than one content type linked to the library you will have to choose between these content types when you save a new document to the library. You can change what content types are associated with the library from within the library settings page. This is by design.


  7. Gravatar

    Just in case someone else is having problems with defining the URL, make sure that it is relative not absolute.

    i.e. /sites/docs/doctemplatelib/filename.dotx

  8. Gravatar

    Hi There!

    After migrating from MOSS 2007 to SP 2010, we're facing a strange situation wherein a document library refused to associate a new document content type as because SharePoint can't find the template doc file which lies in different subsite hierarchy.

    If I create a new document content type and try to associate a doc template (via Enter the URL of an existing document template under Content Type Advanced Settings) by giving the full path of the document such as "server/.../name_of_the_document.doc", it gives me following exception:

    System.IO.FileNotFoundException: The Web application
    at server/.../name_of_the_document.doc could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
    at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
    at Microsoft.SharePoint.SPSite..ctor(String requestUrl)
    at Microsoft.SharePoint.SPWeb.GetServerRelativeUrlFromUrl(String fullOrRelativeUrl, Boolean includeQueryString, Boolean canonicalizeUrl)
    at Microsoft.SharePoint.SPContentType.set_DocumentTemplate(String value)
    at Microsoft.SharePoint.ApplicationPages.ChangeContentTypeOptionalSettingsPage.UpdateContentType()
    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    While If I download this template doc file to my hard disk and then upload it to the document templates via "Upload a new document template" option under Content Type Settings by giving its physical path, it works. I saw the Document Template property for this content type was set to be "name_of_the_document.doc" which I was trying to be setup as "server/.../name_of_the_document.doc"

    I'm doing everything through feature activation code. And at some instance, I found that this code got broke as because of error : "Value does not fall within expected range" for docTemplateUrl = "server/.../name_of_the_document.doc"

    //code where feature breaks

    contentType.DocumentTemplate = docTemplateUrl;

    I would be greatful if you can help me to resolve this issue.


    Best Regards,


  9. Gravatar

    Hi Noah,
    I have the same problem. I got every time a page with content type=ArticlePage, not with my content type. Have you found a workaround ?

  10. Gravatar

    Peter is correct above. This is also a bug. When creating a new document from a content type, Document is the defaulted content type (Even if it is not a valid content type for the doclib). It also requires the user to edit the properties to set the proper content type even though they selected the proper content type in the "New" dropdown. If the user forgets to revisit the document and MANUALLY set the content type, it will never show the properties and the REQUIRED fields will not need to be and CANNOT be updated. Allows invalid data to be stored for a document.

  11. Gravatar

    This post saved me some time today, thnx @mirjamvanolst and @petervandenberg

  12. Gravatar

    I concur that this is a bug. When you create a document from a content type it should not be saved as a different content type and have the user manually change it after the fact. Complete waste of the point of having content types in the first place.

  13. Gravatar

    The main issue I have with this workaround is if the content type you are using has mandatory columns. When you save the template as the content type (not document) it will make you specify values for mandatory columns these will then be populated when you create a new instance of the content type from the new button in the library. This is not good behaviour, is there a workaround for this?

  14. Gravatar

    When you specify the Document Template for a Site Content Type in Advanced Settings, at the bottom there's a setting "Update Sites and Lists / Update all content types inheriting from this type?". If your Site Content Types inherit from one of your Site Content Types - we'll call it the the parent "Parent Site Content Type" and the children "Child Site Content Types" - and you forget to set this to "No", then all your Child Site Content Types will inherit the Document Template of your Parent Site Content Type, and all of your List Content Types based on the Parent Site Content Type AND all your List Content Types based on the Child Site Content Types will be reset to the Document Template of the Parent Site Content Type. You'll have to go back to every Child Site Content Type and reset its Document Template.

    This sucks. But it gets worse.

    If you set the Parent Site Content Type's "Update Sites and Lists / Update all content types inheriting from this type?" setting to "No", when you come back and edit the Advanced Settings for the Parent Site Content Type again, you'll find that the setting has been defaulted back to "Yes". So if you hit "OK" thinking that nothing's changed, you'll find the inheritance hierarchy resets itself again, and you'll have to go to all the Child Site Content Types again and reset them.

  15. Gravatar

    And the point of that is, if you follow Peter vd Berg's process and observe and avoid the unwanted "Document Template reset cascade" described above, you'll find the New Document functionality works ok i.e. it now uses the Document Template of the Document Content Type you selected. At least it did on my system.

  16. Gravatar

    I appreciate Mirjam's workaround and suspected Peter vd Berg's point as the root of my problem when experiencing the same behavior, although I have to disagree that the "by design" feature works correctly, and also have an issue with Peter's solution.

    The issue I have with that is the enabling content types in the template library, which I had already done, and following his process, will make all those content types available on the New button in the templates library (in addition to some base types with associated fundamental templates I have included there for creating new templates in the correct application with some standard headers and footers). That would really clutter the list and make no sense as options for creating new templates.

    When I tried to rememdy this by unchecking those templates in the New button order so that they don't display, that defeated the purpose because they also then don't display in the Content Type dropdown on the Edit Form for assigning to a template file.

    Is there any way to show them in the dropdown but hide them on the New button? Clearly having them on the latter is pointless since if you didn't already have the template you want to assign to that content type the whole issue is moot.

    And as for the buggy functionality of the "Enter the URL" feature, since all my templates have a content type of Document Template - (authoring application name), you would expect if anything it would at least assign the content type of the template to be the content type of document instances created from that template (as Peter suggests) if not the more desirable behavior of the content type on the New button the instance was created with.

    But no, I still get bizarre, seemingly random behavior. Here is the result of one experiment:
    In the content types list for document libary Project_Lib, I have “Unclassified Document” at the top of the list as the default type (a type I created with no additional metadata that inherits from type Document),
    with “Project Document – Excel” next in the list.

    If I click “Unclassified Document” (which has no associated template) from the New button, or click the Upload Document button (both have the same behavior), then the content type for the uploaded doc defaults correctly to “Unclassified Document”.

    However if I upload multiple documents at once, I get bad and unpredictable behavior for the content type assignement. If, for example, I upload multiple Word docs, it ignores the default of “Unclassified Document” and grabs the second content type in the list which is “Project Document – Excel” and definitely wrong (even though I wouldn’t expect it to be smart enough to grab the correct one further down the list, “Project Document – Word”, which has an associated Word template). These will open for editing in Word correctly even though their content type implies Excel (and that content type has an associated Excel template for new docs, but once again I do understand the difference between selecting a type for a new doc and selecting a type as metadata for an upload … I think).

    On the other hand, I just tried uploading 4 documents at once: an Excel spreadsheet (.xslx), a Visio diagram (.vsd), an XML (.xml) file, and a text (.txt) file. All were automatically assigned the content type “Project Document – Excel” (second in the list for the library) except the Visio file which was automatically assigned “Unclassified Document” (first in the list, and even though there is another type in the list called “Project Document – Visio”). The latter file exhibited expected (and more or less desired) behavior however since I wouldn’t expect it to know about the association with the Visio content type automagically. But the other files don’t make sense and should have been Unclassified as well.

    Anyone have recommendations for multiple document uploads or an explanation for this behavior?

    Thanks and sorry for the novel,

  17. Gravatar

    How about aspx?

    I can create a Basic Page, but when users pick a new basic page from the drop-down, all they get is a blank page.

    What I really want to do is to serve a modified basic page that I created as a "customized" template (with the functional content editor)


    What is the best way of doing that?

  18. Gravatar

    I hope Microsoft will understand at some point that adding new content types to a document library is a user's job and not a sharepoint site admin's job and they will make it much simpler.

  19. Gravatar

    You might run into problems when publishing content types with templates to site collections in a different web application. For a workaround solution, read my post @ blog.repsaj.nl/.../sp2010-using-the-content-typ...

  20. Gravatar

    Having Content Types with Document Templates when using "New Document"

  21. Gravatar

    I need it with programatically.

  22. Gravatar

    Yes...this 'feaure' got me again...I must put this somewhere very high on my 'DON'T DO IT' list...

  23. Gravatar

    we need it.


Leave a Reply


Please add 7 and 8 and type the answer here: