Kathy Hughes, MVP

All MindsharpBlogs

SharePoint Encounters

My Links

Archives

Blog Stats

Asia Pacific SharePoint Training

Cats

Citrix

Personal

Resources

SharePoint Training

SharePoint Server 2007 Templates - it's all in the lingo

I was recently working on a project which involved creating and working with custom site templates in SharePoint Server 2007 and, based on questions I was asked and some other discoveries I made, I thought I’d blog about it. Note, here I’m referring to site templates which are created based on an existing site template, or site definition, and stored in the SharePoint database (customized) and have the extension STP – for this discussion, we’ll  assume a LCID of 1033 (en-US). A custom site template is in effect the difference between the originating site definition (uncustomized) on the Web front-end server and the site at the time of saving the site as a template.  Site definitions themselves also include templates, or configurations. For instance, the STS site definition includes the Team Site template, the Blank Site template and Document Workspace template. You can find an overview of custom templates at this URL:- http://support.microsoft.com/kb/825217

Installing Custom Site Templates as Top Level Templates in Central Administration

You can save sites in SharePoint Server 2007 as custom site templates using the browser via the Site Settings page – Look and Feel > Save Site as Template. Note, if you have the Office SharePoint Server Publishing Feature enabled, then the Save Site as Template link will not appear. See my earlier blog post about this:- http://mindsharpblogs.com/kathy/archive/2007/01/06/1465.aspx . The Save Site as Template link will save the site template to the site collection Site Template Gallery and the site template will then become available for subsites within the site collection.

 But if you want to create a top level site template which you can use as the root site when creating new site collections throughout Web applications, you’ll need to use the SharePoint STSADM command line tool to install the custom site template. The top level site templates are accessed when creating a new site collection in Central Administration – Central Administration > Application Management > Create Site Collection. SharePoint will automatically generate a Custom tab in the Template Selection where any custom site templates will be available for selection.

To install a custom site template using STSADM, where the site template is named exercise and located in the root of Drive C:

stsadm –o  addtemplate –filename c:\exercise.stp –title exercise

Note: An iisreset will be necessary before the template is made available.

Other template-related commands include:

To enumerate custom site templates on a SharePoint server:

stsadm –o enumtemplates

To delete a custom site template:

stsadm –o  deletetemplate –title exercise

Note: An iisreset will be necessary to complete template removal

If you work with SharePoint Server 2003, or Windows SharePoint Service v2, then you may also work with site templates, and the procedure for creating top level site templates is similar to that outlined above, using the STSADM command line tool. Templates in SharePoint Server 2007 and Windows SharePoint Services v3 are essentially the same but the name of the scoping reference is different. For example, in SharePoint Portal Server 2003 when you create a top level site template you make that site template available as the root site template for site collections and to all portals on the SharePoint Server. When you create a top level site template in SharePoint Server 2007 you make that site template available as the root site template for site collections and to all Web applications on the SharePoint server.

Limit which Site Templates can be used in subsites within a Site Collection

Another recent question was whether you can control which site templates are made available to subsites within a site collection, including those templates defined in site definitions. I haven’t looked at this programmatically yet but you can do this using the administrative user interface, using Page Layout and Site Template Settings:

Site Settings > Look and Feel > Page Layouts and Site Templates

You’re not limited to controlling site templates from the root site of a site collection – you can choose to set the site templates from any site within a site collection. This not only gives you the option of controlling availability of custom site templates but also site definitions, site definition templates and custom site definitions.

Note, in a site where the Office SharePoint Server Publishing Feature is not enabled, the Page Layouts and Site Templates link will not appear under Site Settings. Instead, you can access the respective administrative page by entering the URL directly into the browser address line, such as:

http://sharepointrus.com/SiteDirectory/marketing/_Layouts/AreaTemplateSettings.aspx

Note: tread carefully when using the above solution, it may not be fully supported.

List Template Portability between different Site Definitions

This section relates in part to DWinter’s earlier post at http://blogs.msdn.com/dwinter/archive/2005/02/24/380169.aspx and demonstrates another example of the portable architecture in SharePoint Server 2007.

I used to use the workaround described at the above blog post when I worked with custom templates in SharePoint Portal Server 2003. Basically, if you created a list template from a custom list in one site where the site was based on a particular site definition, such as STS/Team Site, and then tried to use that list template in another site based on a different site definition, such as a custom site definition, the attempt would fail. You could get around this by using DWinter’s solution – renaming the STP file to CAB and then modifying the XML file.

I’m happy to say this is no longer an issue in SharePoint Server 2007 thanks to Features. I’ve used Features for other projects but it wasn’t until I worked with custom site templates recently that I realized Features has alleviated yet another issue previously encountered in the earlier version of SharePoint.  The Site Template itself no longer governs which sites custom list templates can be applied to. You can read more about this and Features in the WSS v3 SDK:-  http://msdn2.microsoft.com/en-us/library/aa902527.aspx

You might also want to check out the Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions (http://www.microsoft.com/downloads/details.aspx?familyid=19F21E5E-B715-4F0C-B959-8C6DCBDC1057&displaylang=en) which enables you to generate site definitions from existing site templates. But be aware that there are some inherent issues when using the Solution Generator, such as the fact that it will fail if the site on which you’re attempting to create the definition has Publishing Features enabled. See my earlier post above on a workaround for saving publishing sites as site templates.

 

posted on Tuesday, April 10, 2007 1:12 AM

Feedback

# site template reuse tips - size matters 8/24/2007 4:02 PM SharePoint Community Development by Christopher

Sorry for resorting to the cheesy title but think it is worth it to get your attention. I spent quite

# re: SharePoint Server 2007 Templates - it's all in the lingo 5/21/2008 1:26 AM Tee Nguyen

Hi Kathy, this is a great post, thanks. I tried this and created my own sharepoint groups (ex: hr viewers, hr contributors...) on the teamsite template; however, my new sharepoint group and "view only" permission weren't show up when I create new teamsite. Do you know why this happened?

Thanks

# create a new site collection with a saved site template | keyongtech 1/21/2009 9:56 PM Pingback/TrackBack

create a new site collection with a saved site template | keyongtech


Comments on this post are closed.
Title  
Name  
Url
CAPTCHA
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments