[收藏]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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix