Create a Custom Site Definition

Create a Custom Site Definition
We are going to create a custom site definition by copying an existing site definition and then modifying the copy. In the modification stage we will change some CAML core schemas markup in two schema files: one that is a copy of a WebTemp.xml file, and the other a copy of an Onet.xml file.
Caution : You must not modify the originally installed WebTemp.xml file.

1). Copy an existing site definition folder located in the Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\ directory. For Example : Copy and paste the folder titled BLANKINTERNET, re-naming the copy to NEWBLANKINTERNET.
2).Open the ONET.xml file located in the “\NEWBLANKINTERNET\XML\” folder with Visual Studio. This document defines the Navigation Bars, Document Templates, Configurations, Lists, Features, and Modules of the site definitions. I have covered these in detail in my last article. Scroll down to the “Configurations” node and take a look at the given configurations. We’ll reference these later in this exercise.
3).Make a copy of the WebTemp.xml file that is located in Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML.
Give the file a unique name by appending a string to the name of the original file; for example, WebTempAction.xml.
4).Customize the contents of the new WebTemp file. Each WebTemp.xml file contains a collection of Template elements and Configuration subelements.
Description of Template Element
Template Element (Site) : Specifies a site definition that can be used to create Web sites within the deployment.

ID :Required Integer. Specifies the ID of the site definition. To avoid conflict with IDs that are natively used in Windows SharePoint Services, use IDs with values greater than 10,000.
Name : Required Text. Contains the name of the template.
SetupPath :Optional Text. Specifies the relative path in the setup directory that contains files used in the site definition, for example, SetupPath="global".
Important: In each Template element defined in the WebTemp file, the Name attribute must contain the same name that is assigned to the new folder. Also, to avoid conflict with IDs already used in Windows SharePoint Services, use unique values greater than 10,000 for the ID attribute.

Description of Configuration Element

Specifies the lists and modules used in creating a SharePoint Web site that is based on the site definition configuration represented by the Configuration element.

AllowGlobalFeatureAssociations : Optional Boolean. Specifies whether global Feature associations are allowed for sites that are created with the site definition configuration.

CustomMasterUrl : Optional Text. Specifies the URL for an alternate .master page that can be used on pages, in Web sites that are created through the site definition configuration, without unghosting those pages.

Note : Simply changing the value of the MasterPageFile attribute on pages that need an alternate master page, would unghost those pages.

Description :Optional Text. Contains the description of the site definition configuration that appears in the UI of Windows SharePoint Services.

DisplayCategory : Optional Text. Specifies the tab on which the site definition configuration will appear in the UI of Windows SharePoint Services, for example, Collaboration, Meetings, or some custom name.

Hidden :Optional Boolean. Specifies whether the site definition configuration appears as an option in the UI of Windows SharePoint Services.

ID : Required Integer. Specifies an ID for the site definition configuration that is unique within the site definition. A definition, such as STS or MPS, is defined by a Template element in a WebTemp*.xml file and by a corresponding Onet.xml file for the definition. See Parent Elements and Remarks below.

ImageUrl : Optional Text. Contains the URL for the preview image displayed in the UI of Windows SharePoint Services.

MasterUrl : Optional Text. Specifies the default master page to use for Web sites created through the site definition configuration.

Name : Optional Text. Contains the name of the site definition configuration.

RootWebOnly : Optional Boolean. TRUE to specify that the site created from the configuration exists only as the root Web site in a site collection. This attribute is not enforced in site templates (.stp files).

SubWebOnly : Optional Boolean. TRUE to specify that the site created from the configuration exists only as a subsite within a site collection. This attribute is not enforced in site templates(.stp files).

Title :Optional Text. Contains the title of the site definition configuration that is displayed on a tab in the UI of Windows SharePoint Services.

Type : Optional Text. Identifies the site definition, such as STS or MPS.

VisibilityFeatureDependency :Optional Text. Used in a WebTemp*.xml file to hide the site definition configuration based on the activation state of the specified Feature. When a configuration contains Features that depend upon another Feature, setting this attribute prevents the configuration from appearing as an option in the UI of Windows SharePoint Services if the specified Feature is not installed or activated. This attribute is not supported for Features with Web application scope.

You may need to reset Internet Information Services (IIS) to cause the new definition configuration to appear as an option in the UI. To do this, enter iisreset at a command prompt.

No comments:

Post a Comment