您的位置:首页 > 其它

Creating a custom Site Definition in MOSS 2007

2008-12-23 14:51 549 查看

Creating a custom Site Definition in MOSS 2007

The new version of SharePoint brings some changes to the way Site Definitions are created and deployed to a SharePoint server. Additionally, the way Site Definitions are now architected has changed with the advent of Features. Although FrontPage 2003 has been significantly enhanced to become the Office SharePoint Designer, Features allow for more flexible deployments of functionality within SharePoint, and Master Pages allow us to change the look and feel of many sites inside SharePoint with a single click of a button - custom Site Definitions can still be leveraged to provide outstanding enterprise wide flexibility and ease of maintenance for SharePoint sites.
Site Definitions are a complex and large topic that I will not delve into in an in depth manner right now. The purpose of this document is to describe how to create a custom Site Definition in order to set the stage for the other HOW TO articles to follow.
I will be posting another article that will dive deep into Site Definitions in the future.
Currently the MOSS 2007 SDK does not contain any information regarding the creation of a custom Site Definition that is applicable to MOSS 2007. The MOSS 2007 SDK has links inside it to MSDN articles that describe how to create custom Site Definitions in the V2 version of SharePoint.

The process I outline here has been verified against the Beta 2 version of MOSS 2007, but this process may change as newer versions of the product are released.
Site Definition basics
Site Definitions are located in the following folder on the SharePoint server:
C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/SiteTemplates
Each Site Definition has its own sub directory under this folder.
Inside each Site Definition sub directory the aspx pages for the various web pages and lists that make up the Site Definition are stored. The ONET.XML file that specifies the various configurations and modules the Site Definition is made up of is stored inside the XML subdirectory inside each Site Definition sub directory.
*Note: I think it is interesting that the SDK refers to Site Templates as the .stp files that are generated when you save a site as a template from the SharePoint web UI, and the SDK refers to file based site templates as Site Definitions – yet this directory is named SiteTemplates.
Site Definitions are registered with SharePoint and made available via the WEBTEMP<NAME OF SITE DEFINITION>.XML file.
These WEBTEMP files are located in the following folder on the SharePoint server:
C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/1033/XML
Creating a custom Site Definition in MOSS 2007
The following tasks are all you need to do to create a custom Site Definition in MOSS 2007.
Step 1: Clone an existing Site Definition.
Step 2: Create the WEBTEMP XML fragment file to register the Site Definition with SharePoint.
Step 3: Reset IIS
Step 4: Create a site based on the custom Site Definition.
Step 1: Clone an existing Site Definition.
Navigate to the following directory on the SharePoint server in Windows Explorer:
C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/SiteTemplates
Copy the sts directory and paste it back into the same directory.
Rename the Copy of sts directory to SAMPLE
Navigate to the following directory on the SharePoint server in Windows Explorer:
C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/1033
Copy the STS directory and paste it back into the same directory.
Rename the Copy of STS directory to SAMPLE
Step 2: Create the WEBTEMP XML fragment file to register the Site Definition with SharePoint.
Create a file called WEBTEMPSAMPLE.XML in the following directory:
C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/1033/XML
Put the following XML into the WEBTEMPSAMPLE.XML file:
<?xml version="1.0" encoding="utf-8" ?>
<!-- _lcid="1033" _version="12.0.4017" _dal="1" -->
<!-- _LocalBinding -->
<Templates xmlns:ows="Microsoft SharePoint">
<Template Name="SAMPLE" ID="10001">
<Configuration ID="0" Title="Sample Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="This sample template creates a site for teams to create, organize, and share information quickly and easily. It includes a Document Library, and basic lists such as Announcements, Calendar, Contacts, and Quick Links." DisplayCategory="Custom Site Definitions" > </Configuration>
<Configuration ID="1" Title="Sample Blank Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="This sample template creates a Windows SharePoint Services-enabled Web site with a blank home page. You can use a Windows SharePoint Services-compatible Web page editor to add interactive lists or any other Windows SharePoint Services features." DisplayCategory="Custom Site Definitions" > </Configuration>
<Configuration ID="2" Title="Sample Document Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/dwsprev.png" Description="This sample template creates a site for colleagues to work together on documents. It provides a document library for storing the primary document and supporting files, a Task list for assigning to-do items, and a Links list for resources related to the document." DisplayCategory="Custom Site Definitions" > </Configuration>
</Template>
</Templates>
*Note: The DisplayCategory attribute of the <Configuration> element dictates which tab the configuration will appear on in the Template Selection section of the create site web page. You can create your own tabs by putting your own values in this attribute (like we have done here).
Save the file.
Step 3: Reset IIS
Open a command prompt on the SharePoint server.
Type in the command: iisreset
Wait for IIS to reset
Step 4: Create a site based on the custom Site Definition.
Open Internet Explorer
Navigate to the Sites Directory in your SharePoint portal (http://SharePointServerName/SiteDiectory)
Click the Create Site Link
Fill out the information on the form.
Notice at the bottom of the page in the Template Selection section the new Custom Site Definitions tab.
Click this tab and select one of the available configurations.
Click the Create button.
You have now created your own custom Site Definition to develop upon!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐