Working with Sharepoint Portal Server 2003 Area Templates

There are some documentation out there on Sharepoint Portal Server 2003 (SPS) Area Templates. None however gave me the full overview I needed in order to be able to customize my Areas in the ways I wanted. This article sums up lessons learned in working with Area Templates.

This article applies to working with Areas. Areas are a feature of SPS, not Windows Sharepoint Services (WSS) that ship with Windows 2003 server.

The site backbone for SPS is the Area (as described here). The Area concept replaces the "Category" used in Sharepoint 2001, and this term is no longer valid. You will although it encounter the term in some contexts throughout SPS2003 as well. The Area appears in many different shapes and forms. Microsoft have included several templates for Areas out of the box: Topic Area, Community, News Area and more. All of these standard areas are created based on templates defined in CAML and their appearance are also influenced by template ASP.NET Web Forms. To be able to create such Templates for your SPS solution is an extremely powerful feature.

There are unfortunately no applications available to assist you in this task so it might seem a bit cumbersome at first. Lets have a look at the existing Templates that ship with SPS and are located in this folder: 

C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\<Your language Code>

The language code (1033 for english) separates the templates for different localizations. Furthermore you can see a set of directories prefixed with "SPS" and some that are not. The directories contains:

  • STS :  the template for Sharepoint Team Site that ships with WSS
  • MPS : templates for the different workspace sites, also WSS
  • XML : xml files that control the configuration and loading of the templates
  • SPS* : the standard Templates you get to choose from when creating new Areas in SPS

What is important to note here is that templates for creating WSS teamsites have the same structure as templates for creating SPS Areas. This have implications for what CAML elements in the configurations that actually have effect. Some elements are included in i.e. the SPSCOMMU template that does absolutely nothing. If the template had been applied to a teamsite they would. Of course Microsoft has made sure to hide the possibility of applying a "non-compliant" template to a Team Site or an Area, but it is possible and it looks really bad.

So, lets cut to the chase. We want to make an area template because our portal is going to take advantage of the features included in SPS and not rely solely on WSS Team Sites. We will start by making a copy of the SPSNEWS folder and renaming it to SPSMYAREATMPL.

Next we need to let Sharepoint know about the new template. To accomplish this we need to make a new WEBTEMP*.XML file in the XML directory located in the templates root dir (TEMPLATE\<Your language code>\XML). Sharepoint dynamically reads all files in this folder that matches the WEBTEMP*.XML filter so we'll just copy the WEBTEMPSPS.XML file and rename it to WEBTEMPSPSMYAREATMPL.XML, thus matching the directory name. Finally edit the XML file to make it look like this:

<?xml version="1.0" encoding="utf-8" ?>
<Templates xmlns:ows="Microsoft SharePoint">
  <Template Name="SPSMYAREATMPL" ID="10000">
   <Configuration ID="0" Title="My area template" Type="0" Hidden="TRUE" ImageUrl="../images/spshome.gif" Description="This template will test news and listings" />
 </Template>
</Templates>

Note that the Name attribute must match the directory name and be uppercase. The ID is recommended to be above 10000 even though SPS only uses the numbers up to 36. Now my new template is ready to go and as soon as IIS is reset (use IISRESET in cmdline) it will appear in the Sharepoint Portal Server Area Template selection.

The next step is to adjust and elaborate the template to your requirements. There are two main ways to alter the content:

  • Edit ASP.NET Web Forms in the template directory structure in FrontPage. Changes will affect all new and existing Areas created based on this template.
  • Edit the XML configuration files in the XML subdirectory located within the SPSMYAREATMPL dir. Changes only affects Areas created after IIS Reset.

To get started creating your template start with opening the default.aspx in FrontPage. Because this is not a Web, FrontPage will be less helpful, and I recommend sticking to editing the tags once you've got the overview of the content. You can also add new webforms for use by your template.

The second way to change your template is to edit the configuration files. The most important one is  ONET.XML. This file dictates the structure of your Area when it is created. Remember that you have to restart IIS and create a new Area based on your template to see changes in your template. This is the main drawback when working with Area Templates. An important element to check out is the /Modules/Module/File@Url="default.aspx". Here you can set up the webparts, lists and other elements you want to appear on your Area. Read up in the CAML reference to get an understanding for the rest of the elements. Note that the NavBars element have no effect on Area Templates.

I have showed how to create a custom Area Template for Sharepoint Portal Server 2003. Now you can customize your own Area and create countless instances of it in your portal site. Cool things you can continue with is to create new custom lists , remove elements you don't need, alter the layout and more. Please feel free to contact me if you are doing smart stuff with templates!

Working with the MySite configuration

In the template folder you will also find the default template for the MySite configuration. You might think this works in the same matter as the other templates, but no. Editing the default.aspx in the SPSMSITE folder has the same effect, but altering ONET.XML has no effect. This is due to the fact that Sharepoint creates the virtual site that handles all MySite sites on installation, thus only processing the ONET.XML in the SPSMSITE folder once. To alter the MySite template for all users on your portal use FrontPage and navigate to your RootSite/MySite, then perform your changes.

This inconsistency is kind of hard to spot, and reduces the possibility of preconfiguring the setup of a site before it is rolled out. Not much to do about that though.

References

Customizing Templates for Microsoft Windows SharePoint Services
Introduction to Templates and Definitions
Overview of Custom Templates in SharePoint Portal Server 2003 and Windows SharePoint Services
A ppt from SharepointCustomization.com (currently unavailible)
Working with Templates
Introduction to CAML
Creating a List Definition
Server and Site Architecture Overview
ONET.XML CAML Reference
 

11 Comments

  • I am the Content Manager for the company's intranet and we are at present installing Sharepoint 2003. Can templates be customised by using Frontpage?

  • Not as far as i know. Frontpage can be used to edit the sites that have been created from the templates. I beleive altering templates is not a &quot;supported&quot; feature by Microsoft as of now.

  • Hi,



    did you manage to insert default web parts into *other* pages than default.aspx?



    i tried altering the &lt;module&gt; part in onet.xml to get a web part included as default (in a custom web part zone) and it works fine but *only* in default.aspx, not in fx allitems.aspx.



    I tried different combos but none worked so far :-(

  • I cannot find a way to get some of my own templates being the template used for home page at the creation of a new portal.



    Do you have some information for that particular case ?

  • Do you know how to do a lookup to another list in a site definition.



    suheb@blueyonder.co.uk



    Thanks

  • Please help me to understand the following:



    I need to create an interanet site that has 7 sections, each of them having similar look, difference is only in color schema and top images. Each section might have several subsections, which derive look&amp;feel from parent section.



    I also need to apply our style on the portal home.



    Which is the best way to achieve these results in SharePoint Portal Server 2003 ? How many templates will I need to create, etc ?

  • how to have a list lookup data reference of one site to many sites using Share Point Services.



    Please do assist me with a possible solution.



    send to my email id : sadiq@giordano.com.sa

  • Hi,



    I am working on customizing sharepoint portal for following:



    1. Create a docucment work space to create a policy and procedure doctrine.

    2. Publish this doctrine on the web with custom look and feel, navigation for logged-in users.

    3. Automate the publish method and dynamic navigation.



    What is the best way to achieve this.



    Please email me on plikhmania@tbconsulting.com.



    Thanks,

    Pankaj

  • With regard to the Sites Area in the Portal...this page does not reflect an updated/customized css as does the rest of the portal.



    Any thoughts on why this one page in the portal will not display the new stylesheet properties? Is a portion of this page locked or does the the new css need to be in the same directory as the original css?

  • After I have follow the instructions and restart the IIS... the new created template still not appear in the Sharepoint Portal Server Area Template selection... can advise on this?... Thanks...

  • Hello...

    Jess, becareful with the directory name. It's very important that you start de name with SPSXXXX. If you forget this, you won't be able to accomplish the task. Thanks Mads for this post. It was very helpfull in nowadays. Greetings!.

Comments have been disabled for this content.