Utilizing Document Library Templates

Document Library Templates can be a very useful tool but how to use it is not very clear.  Granted when you create a new Document Library it gives you an option to select an existing template.  Ever wonder where these templates come from?  How to modify these base templates? Or how to modify a selected template?  In this post I will answer these questions.

Question 1: Where are these base templates?

Answer: The base templates are stored in the infamous SharePoint 12 hive (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\STS\DOCTEMP/ directory).  You will notice that within the 12 hive the base templates are actually stored in 1033 directory.  This is the United States site definition, depending on the site definition you are running it could be a different number.  Notice that there is a different folder for each template type.  I will break down the mapping between each Template option and the accompanying file.

Document Template Name Related File Path and Name
Microsoft Office Word 97-2003 document \WORD\WDTMPL.DOC
Microsoft Office Excel 97-2003 spreadsheet \XL\XLTMPL.XLS
Microsoft Office PowerPoint 97-2003 presentation \PPT\PPTMPL.POT
Microsoft Office Word document \WORD\WDTMPL.DOTX
Microsoft Office Excel spreadsheet \XL\XLTMPL.XLSX
Microsoft Office PowerPoint presentation \PPT\PPTMPL.PPTX
Microsoft Office OneNote section \ONENOTE\Template.one
Microsoft Office SharePoint Designer Web page \FP\FPTMPL.HTM
Basic page \BLANKPGS\bpstd.aspx 
Web Part page New Web Part Page form

You will notice that the last template option Web Part page does not relate to a particular file in the DOCTEMP directory.  This is because it utilizes the New Web Part Page form. For more details about the New Web Part Page form, refer to my previous posting Here Quick Launch Bar, Quick Launch Bar. Here Quick Launch Bar. Now where could it have gone?

Question 2: How do I modify the existing base template?

Answer: Unfortunately since the base Document Templates are built into the site definition, it is risky to update the templates directly as there is a potential that future patches from Microsoft could potentially affect the base templates.  If you would like to go ahead and modify the base Document Template anyway, refer to the table above to locate the appropriate template file.

You might be wondering by now why I keep classifying the 12 hive template files as "base" templates, this is because they are only reference on first creation of the Document Library.  When you create a new Document Library and you select a Document Template to include, this list is derived from the base templates mentioned above.

SharePoint takes the selected base template and copies the template file to a web folder in the newly created document library called Forms.  The template file is then renamed to template.appropriateFileExtension (for example, template.doc or template.dotx, etc) which leads us into Question 3.

Question 3: How do I modify the existing template file for my document library?

Answer:  There are 2 different ways you can achieve this:

Option 1: If you want to update the existing Document Template with same file extension, do the following

  1. Open the Document Library Settings page.
  2. Click on Advanced settings found in the General Settings section.
  3. In the section Document Template click on Edit Template link.

    This will open the template file in the appropriate file editor program (for example .doc or .dotx will open in Office Word).
  4. Modify the template as you see fit and then save the file.  This action will upload the modified template directly into the Forms folder of the document library and will be available to the end users immediately.

Option 2: If you would prefer to provide either a completely different template file or simply replace the existing one, do the following steps

  1. Open the Internet Explorer browser.  In the File menu, select Open.  Enter the URL up to the library, for example, my library URL is http://TestServer/SiteDirectory/JeffC/Document%20Template%20Options/Forms/AllItems.aspx,
  2. Select the option Open as Web Folder and click OK.
  3. Confirm that you are in the Forms folder of the library.  Here you will notice several ASPX files, these are both the Document Library page Views and various meta data forms, leave these files be.  Locate the template file you want to manipulate or upload a new template file.
  4. Navigate back to the Document Template section located in Advanced Settings page of the given Document Library as described in Option 1.
  5. Make sure the Template URL is formed correctly.  It should be Original Document Library Name/Forms/NameOfNewTemplatefile.Extension  *Notice that I underlined the first part of the path.  When you first create a Document Library in SharePoint, to remove the chance of breaking existing links, it will always use the original document library name for links instead of the existing display name.

You have successfully updated the Document Template mapped to the specific Document Library.

On the flip side, if you have originally selected a Document Template for a given library and you have decided not to use the template any more, you can go to the Document Template section of the Advanced Settings of a given library and delete the existing contents of the field.  This will remove the option from the New action menu and if you have turned of folders, the New action menu will disappear completely.


Posted May 13 2008, 07:00 AM by Jeff Kozloff

Comments

Bamboo Nation - Excellent SharePoint Posts « The WorkerThread Blog wrote Bamboo Nation - Excellent SharePoint Posts « The WorkerThread Blog
on Sat, May 17 2008 8:59 AM

Pingback from  Bamboo Nation - Excellent SharePoint Posts « The WorkerThread Blog

microsoft office onenote 2007 templates wrote microsoft office onenote 2007 templates
on Thu, May 22 2008 4:48 AM

Pingback from  microsoft office onenote 2007 templates

Nick Parkes wrote re: Utilizing Document Library Templates
on Tue, Oct 28 2008 7:14 AM

You absolute genius! Thanks - been searching how to do this for weeks!

Nick Parkes wrote re: Utilizing Document Library Templates
on Tue, Oct 28 2008 7:15 AM

Note - that I'm doing this successfully on wss2 - sharepoint portal server 2003. its all good.

Jeff Kozloff wrote re: Utilizing Document Library Templates
on Tue, Oct 28 2008 7:49 AM

Hello Nick,

I am glad to hear that this helped you.  It is also great to hear it also works with WSS v2/ SPS 2003.

Jeff

DJ Lordee wrote re: Utilizing Document Library Templates
on Fri, Nov 7 2008 5:05 PM

Hi,

Do you know if we can use a non MS Office document as a document template?

Thanks,

DJ Lordee

About Jeff Kozloff

Jeff originally joined Bamboo Solutions in June of 1999 as a part-time Test Engineer (basically a gopher). He continued with Bamboo as a part time tester while obtaining my Bachelors of Science in Computer Science degree at Longwood University. Upon graduation in 2004, Jeff accepted a full time position at Bamboo as a Helpdesk Specialist and became Manager of the Helpdesk team in 2006. In October of 2007 until present, Jeff took a role as Project Manager in the Solution group bringing his in depth technical knoweldge of SP to Bamboo's customers.

Bamboo Solutions Corporation, 2002-2009