Sep 3, 2008

Restricting Usage of Site Templates in SharePoint

SharePoint Site Collections enable restriction of site templates and page layouts via a simple modification on site settings in the browser. Go to the site settings of a single site or the site collection main site (Site Actions > Site Settings > Modify All Site Settings) and choose Look and Feel -ryhmästä Page layouts and site templates.

This setting can be modied in Publishing Sites or wss-sites with publishing features activated (these features can be activated in site settings:: Site Actions > Site Settings > Site Features, Office SharePoint Server Publishing > Activate, note that this setting is not inherited by subsites).

On the Page layouts and site templates page the usage of site templates and page layouts can be set in three different ways:

  1. Set subsites to inherit templates or layouts from parent site (the site where the setting is modified)
  2. Give the subsites permission to use any templates or layouts
  3. Give the subsites permission to use only specifically determined templates or layouts

Subsites can be reset to inherit these settings by selecting Reset all subsites to inherit… The setting is inherited by existing publishing and wss sites and new publishing sites, but not new wss sites.

If this seems insufficient, one can always take up more severe measures in restricting usage of Site templates and page layouts.

Page layouts aren't a problem, really, since by spcifying the permitted page layouts in the settings of the site collection and inheriting the settings to subsites, the setting really goes all the way through the site collection. And if you want to, you can always manage them further in the Master Page and page layout gallery (in site collection settings Site Actions > Site Settings ja Galleries > Master pages and page layouts) and delete (or move to another location) the page layouts that are not to be used at all:

Site templates, on the other hand, require the tampering of a set of XML files - those of customized Site Definitions (if there are such) and those managing the templates of the whole Web Application.

On the SharePoint server, the \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML directory contains these XML files to modify. Of these, the WEBTEMP.XML file is the one containing settings for site templates, except for the Publishing and Enterpise tabs. Templates can be hidden from view & thus from usage by setting the value of the attribute Hidden to be "TRUE" on those templates you wish to hide.

This is actually the only supported action in these XML files - and even this is an exception (More about Microsoft Supported ja unsupported scenarios on the Microsoft site: http://support.microsoft.com/default.aspx/kb/898631 ).

Hiding templates on the Publishing tab is done similiarly in the webtempsps.xml file. The Enterprise tab is a tad more complex thing to modify, as each template has its own XML file, but they are all situated in the same XML directory with these already mentioned files.

Own tabs can be created - or the existing ones "renaimed" (but as a reminder, this is not officially supported) by setting the value of the DisplayCategory attribute: DisplayCategory="Own tab name" in the XML files.

After this, one question remains: how to make the site templates saved in the browser (in the site settings of a wss site Look and Feel > Save site as template) to appear on a tab not named Custom?

The name of the Custom tab can be changed by modifying the value of TemplatePickerControl_Custom in the \Program Files\Common Files\Microsoft Shared\web server extensions\12\Resources\core.[en-US].resx file:

Remember to make backups before tampering with the original files! And after modifying the files, be sure to perform iisreset in order to apply the changes.

No comments: