Thursday, October 11, 2007

Site Definition

A site definition is the top-level component in WSS that aggregates smaller, more modular
definitions to create a complete site template that can be used to provision sites.

A site definition itself does not represent a creatable site template. Instead, a site definition
contains one or more configurations, and these configurations are what appear to users as
creatable site templates. Therefore, the STS site definition contains three different
configurations: Team Site, Blank Site, and Document Workspace.

Site definitions are deployed within the 12\TEMPLATE\
SiteTemplates directory and are referenced in the 12\TEMPLATE\<culture>\XML directory in
WEBTEMP.XML files, where the <culture> folder is the locale identifier (12\TEMPLATE\
1033\XML for US English).

Web Template Files WEBTEMP.XML

<?xml version="1.0" encoding="utf-8"?>
<!-- _lcid="1033" _version="12.0.4518" _dal="1" -->
<!-- _LocalBinding -->
<Templates xmlns:ows="Microsoft SharePoint">
 <Template Name="GLOBAL" SetupPath="global" ID="0">
 <Configuration ID="0" Title="Global template" Hidden="TRUE" ImageUrl="" Description="This template is used for initializing a new site." > </Configuration>
 </Template>
 <Template Name="STS" ID="1">
 <Configuration ID="0" Title="Team Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="A site for teams to quickly organize, author, and share information. It provides a document library, and lists for managing announcements, calendar items, tasks, and discussions." DisplayCategory="Collaboration" > </Configuration>
 <Configuration ID="1" Title="Blank Site" Hidden="FALSE" ImageUrl="/_layouts/images/blankprev.png" Description="A blank site for you to customize based on your requirements." DisplayCategory="Collaboration" AllowGlobalFeatureAssociations="False" > </Configuration>
 <Configuration ID="2" Title="Document Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/dwsprev.png" Description="A site for colleagues to work together on a document. It provides a document library for storing the primary document and supporting files, a tasks list for assigning to-do items, and a links list for resources related to the document." DisplayCategory="Collaboration" > </Configuration>
 </Template>
 <Template Name="MPS" ID="2">
 <Configuration ID="0" Title="Basic Meeting Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/mwsprev.png" Description="A site to plan, organize, and capture the results of a meeting. It provides lists for managing the agenda, meeting attendees, and documents." DisplayCategory="Meetings" > </Configuration>
 <Configuration ID="1" Title="Blank Meeting Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/blankmwsprev.png" Description="A blank meeting site for you to customize based on your requirements." DisplayCategory="Meetings" > </Configuration>
 <Configuration ID="2" Title="Decision Meeting Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/decisionmwsprev.png" Description="A site for meetings that track status or make decisions. It provides lists for creating tasks, storing documents, and recording decisions." DisplayCategory="Meetings" > </Configuration>
 <Configuration ID="3" Title="Social Meeting Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/socialmwsprev.png" Description="A site to plan social occasions. It provides lists for tracking attendees, providing directions, and storing pictures of the event." DisplayCategory="Meetings" > </Configuration>
 <Configuration ID="4" Title="Multipage Meeting Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/multipagemwsprev.png" Description="A site to plan, organize, and capture the results of a meeting. It provides lists for managing the agenda and meeting attendees in addition to two blank pages for you to customize based on your requirements." DisplayCategory="Meetings" > </Configuration>
 </Template>
 <Template Name="CENTRALADMIN" ID="3">
 <Configuration ID="0" Title="Central Admin Site" Hidden="TRUE" ImageUrl="" Description="A site for central administration. It provides Web pages and links for application and operations management." > </Configuration>
 </Template>
 <Template Name="WIKI" ID="4">
 <Configuration ID="0" Title="Wiki Site" Hidden="FALSE" ImageUrl="/_layouts/images/wikiprev.png" Description="A site for a community to brainstorm and share ideas. It provides Web pages that can be quickly edited to record information and then linked together through keywords" DisplayCategory="Collaboration" > </Configuration>
 </Template>
 <Template Name="BLOG" ID="9">
 <Configuration ID="0" Title="Blog" Hidden="FALSE" ImageUrl="/_layouts/images/blogprev.png" Description="A site for a person or team to post ideas, observations, and expertise that site visitors can comment on." DisplayCategory="Collaboration" > </Configuration>
 </Template>
</Templates>

Site Definition Project Schema Sample ONET.xml

<?xml version="1.0" encoding="utf-8"?>
<Project Title="My Site Definition"
Revision="0"
ListDir="Lists"
xmlns:ows="Microsoft SharePoint"
xmlns="http://schemas.microsoft.com/sharepoint/">
 <NavBars>
 <NavBar Name="Site Pages"
 Prefix="&lt;table border=0 cellpadding=4 cellspacing=0&gt;"
 Body="&lt;tr&gt;&lt;td&gt;&lt;table border=0 cellpadding=0 cellspacing=0&gt;&lt; 

    
tr&gt;&lt;td&gt;&lt;img src='/_layouts/images/blank.gif' ID='100' alt='' border=
0&gt;&amp;nbsp;&lt;/td&gt;&lt;td valign=top&gt;&lt;a ID=onetleftnavbar#LABEL_ID# href=
      
'#URL#'&gt;#LABEL#&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;"
Suffix=
"&lt;/table&gt;"
 ID="1028" >
 <NavBarLink Name="Web Page 1" Url="SitePages/Page01.aspx" />
 <NavBarLink Name="Web Page 2" Url="SitePages/Page02.aspx" />
 <NavBarLink Name="Web Page 3" Url="SitePages/Page03.aspx" />
 <NavBarLink Name="Web Page 4" Url="SitePages/Page04.aspx" />
 </NavBar>
 </NavBars>
 <DocumentTemplates />
 <Configurations>
 <Configuration ID="-1" Name="NewWeb" />
 <Configuration ID="0" Name="Default">
 <Lists>
 <!-- Adds the Litware Vendor List -->
 List FeatureId="FBDECD96-62DC-48c8-8F0A-7B827A042FD9" Type="10001"
 Title="Litware Vendors"
 Url="Lists/Vendors" QuickLaunchUrl="Lists/Vendors/AllItems.aspx" />
 <!-- Adds the Litware Customer List -->
 List FeatureId="FBDECD96-62DC-48c8-8F0A-7B827A042FD9" Type="10002"
 Title="Litware Customers"
 Url="Lists/Customers" QuickLaunchUrl="Lists/Customers/AllItems.aspx" />
 <List FeatureId="00BFEA71-D1CE-42de-9C63-A44004CE0104" Type="104"
 Title="Announcements"
 Url="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;">
 <Data>
 <Rows>
 <Row>
 <Field Name="Title">
 $Resources:Litware,DefaultAnnoucementTitle;
 </Field>
 <Field Name="Body">
 $Resources:Litware,DefaultAnnoucementBody;
 </Field>
 <Field Name="Expires">&lt;ows:TodayISO/&gt;</Field>
 </Row>
 </Rows>
 </Data>
 </List>
 </Lists>
 <Modules>
 <Module Name="Default" />
 </Modules>
 <SiteFeatures>
 <!-- The Basic Web Parts feature installs the WSS Web Part entries. -->
 <Feature ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57" />
 </SiteFeatures>
 <WebFeatures>
 <!-- The Team Collaboration feature includes the basic site lists. -->
 <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" />
 </WebFeatures>
 </Configuration>
 </Configurations>
 <Modules>
 <Module Name="Default" Url="" >
 <File Url="default.aspx" NavBarHome="True" Type="Ghostable"></File>
 </Module>
 <Module Name="Default" Url="" SetupPath="sitetemplates\sts">
 <File Url="default.aspx" NavBarHome="True" Type="Ghostable">
 <View List="$Resources:core,lists_Folder;/ 

    
$Resources:core,announce_Folder;"
BaseViewID="0" WebPartZoneID="Left" WebPartOrder="0" />
 <View List="Lists/Vendors" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="1" />
 <View List="Lists/Customers" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="2" />
 </File>
 </Module>
 <Module Name="Default" Url="" SetupPath="features\customsitepages">
 <File Url="default.aspx"
 NavBarHome="True"
 Type="Ghostable"
 Path="PageTemplates\Page01.aspx" />
 <File Url="topsites.aspx" Type="GhostableInLibrary" >
 <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/tabviewpagelayout.aspx, $Resources:spscore,TabViewPageLayoutTitle;" />
 <Property Name="Title" Value="$Resources:spscore,SiteDirectoryTopSitesPageTitle;" />
 <Property Name="Comments" Value="$Resources:spscore,SiteDirectoryTopSitesPageDescription;" />
 <AllUsersWebPart WebPartZoneID="Header" WebPartOrder="1">
 <![CDATA[
 <WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
 <Title>$Resources:spscore,ReportCenterOnet_CWP_Title</Title>
 <FrameType>TitleBarOnly</FrameType>
 <Description>$Resources:spscore,ReportCenterOnet_CWP_Description</Description>
 <IsIncluded>true</IsIncluded>
 <ZoneID>TopLeftZone</ZoneID>
 <PartOrder>1</PartOrder>
 <FrameState>Normal</FrameState>
 <Height />
 <Width />
 <AllowRemove>true</AllowRemove>
 <AllowZoneChange>true</AllowZoneChange>
 <AllowMinimize>true</AllowMinimize>
 <IsVisible>true</IsVisible>
 <Hidden>false</Hidden>
 <DetailLink />
 <HelpLink />
 <Dir>Default</Dir>
 <PartImageSmall />
 <MissingAssembly />
 <PartImageLarge>/_layouts/images/wp_pers.gif</PartImageLarge>
 <IsIncludedFilter />
 <Assembly>Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
 <TypeName>Microsoft.SharePoint.Portal.WebControls.ContactFieldControl</TypeName>
 </WebPart>
 ]]>
 </AllUsersWebPart>
 <AllUsersWebPart WebPartZoneID="TopZone" WebPartOrder="1">
 <![CDATA[
 <webParts>
 <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
 <metaData>
 <type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
 <importErrorMessage>$Resources:spscore,WPImportErrorMessage;</importErrorMessage>
 </metaData>
 <data>
 <properties>
 <property name="Title" type="string">$Resources:spscore,TopSitesWebpartTitle;</property>
 <property name="Description" type="string">$Resources:spscore,TopSitesWebpartDescription;</property>
 <property name="ChromeType" type="chrometype">None</property>
 <property name="WebUrl" type="string">~Site</property>
 <property name="ListName" type="string">$Resources:spscore,SitesOnet_SitesList_Title;</property>
 <property name="ItemStyle" type="string">Bullets</property>
 <property name="XslLink" type="string">~SiteCollection/Style Library/XSL Style Sheets/ContentQueryMain.xsl</property>
 <property name="QueryOverride" type="string">&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name="TopSite" /&gt;&lt;Value Type="Boolean"&gt;1&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;</property>
 <property name="CommonViewFields" type="string">URL,URL;Description,Note</property>
 <property name="BaseType" type="string">0</property>
 <property name="DataColumnRenames" type="string">URL,LinkUrl;Description,LinkToolTip</property>
 <property name="FilterField1" type="string">{fdc3b2ed-5bf2-4835-a4bc-b885f3396a61}</property>
 <property name="FilterOperator1" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c">Eq</property>
 <property name="FilterValue1" type="string">Approved</property>
 </properties>
 </data>
 </webPart>
 </webParts>]]>
 </AllUsersWebPart>
 </File>
 </Module>
 </Modules>
</Project>
 

No comments: