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

Popular posts from this blog

Apply CSS styles to SharePoint Web parts

SharePoint Number Column Without Commas

Use of Information Rights Management (IRM) in SharePoint