Share via


Custom Site Definition for collaboration portal template SharePoint 2007 !! Wow MOSS !!

Hey I knew how to create custom site definition and created custom site definitions for a top level team site and a custom site definitions for Custom Serach Centre and the documents centre. Hurray !!! But how can i integrate all these three definitions into a single portal template so that one can choose the template and create a top level site along with the custom search centre and the documents centre as a sub site.

 

Oh yeah !! This feature has been given as collaboration portal template in the OOb sharepoint site definition. But they uses the OOb site definitions to create any sub sites and the collaboration portal what if i want to create a custom portal collaboration portal definition ?....

 

This blog post will walk you through creating custom site definition and creating custom site definition for collaboration portal template.

 

 

What is Site Definition?

 

A set of predefined components needs to be included when a site was created in the SharePoint server. The site definition contains the information of Web parts, Lists, Features, and Navigation Bars to be included in the site.

OOB Site Definition:

 

By default SharePoint comes with several OOB site definitions which you can select to create your site. In the file system these definitions are available in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates.

Each of this site definition consists a XML folder and a Home page (default.aspx). Some of the site definition will be having some more details about the definition which we will walkthrough in more detail later.

The XML folder of the site definition contains the ONET.XML (Office .NET) file. This file contains the information about all the web parts, Lists, Features and Navigation Bars.

The configuration of this site definitions are defined in another XML file which is available in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML folder.

Following is the detail of the XML configuration file and the respective site definitions

Configuration XML file

Site Definition

WEBTEMP.XML

STS,MPS,CENTRALADMIN,BLOG,WIKI

WEBTEMPSPS.XML

SPS,SPSPERS,SPSMSITE,SPSTOC,SPSTOPIC,SPSNEWS,BLANKINTERNET,SPSNHOME,SPSSITES, SPSCOMMU, SPSREPORTCENTER, SPSPORTAL, SRCHCEN, PROFILES, SPSMSITEHOST

WEBTEMPSRCH.XML

SRCHCENTERLITE

WEBTEMPOFFILE.XML

OFFILE

 

How to create custom site definition:

When you want to mention your own site definition to include some more web parts, Lists, features on creation of the site you need to create your custom site definition . You should not make changes in the OOB site definition files and it is not supported.

Based on the architecture of OOB site definition you need to create your custom site definition.

1.    Create a site definition folder under C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates. You can copy any of the existing site definition folder based on which OOB site definition you are going to extend the definition. Consider if you are going to extend the definition of Team Site then you need to copy the “sts” folder and paste it with your custom site definition name.

2.    Create a configuration XML file under C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML folder. You can copy the existing configuration file which configures the site definition based on which you are extending the custom site definition. Consider if you are going to extend the definition of Team Site then you need to copy the WEBTEMP.XML file. The naming convention is mandatory here and you need to name your custom webtemp.xml file in the following format WEBTEMP*.xml. (The SharePoint looks for the configuration inside the files which starts with WEBTEMP)

3.    In custom WEBTEMP*.xml file you need to mention the custom site definition template folder name and need to mention the ID for it. The ID should be greater than 10000

4.    You can mention any number of configuration per template provided you need to mention the contents for every configuration in the ONET.XML file.

5.    The following snippet shows the sample custom WEBTEMP*.xml file :

<Templates xmlns: ows="Microsoft SharePoint">

<Template Name=" <Your Custom Site definition Folder name>" ID="<The ID should be greater than 10000(from 1-10000 it was reserved by Microsoft for the OOB site definitions">

    <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." Display Category="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>

</Templates>

 

Site Definition of collaboration portal Template

=========================================

 

The process of the Collaboration portal site definition is different from the process and the flow of other site definition.

1. Consider you have created some custom site definition for team site, search center and document centre individually.

2. Now you want to provide such a template so that while creating a top level site using the template a collaboration sites for document center and the search center should be created based on your custom site definition.

3. In more detail, You have Custom Site definition "A" for team site, Custom Site definition "B" for document center, Custom site definition "C" for Search Center. You want to provide a template such that a collaboration site should be created along with the search center and document centre by default.

The portal site definition uses the portalprovisioningprovider class in the Microsoft.SharePoint.Publishing Assembly. This class parses through a XML file and builds the Hierarchy defined in the file. This file is available under 12\Template\Site Templates\WebManifest. This PORTALWEBMANIFEST. Xml file defines the web templates to be used for the sites under the portal site.

The Basic Site definitions for portal site are available in 12\Template\Site templates\SPS. Making any changes in this template is not recommended or supported by Microsoft (the future updates will overwrite the custom definition as this templates are owned by Microsoft).

1.    To create a custom site definition for portal Site, Create a copy of this SPS folder and name it as SPS*

2.    Create a copy of WEBTEMPSPS.xml file and name it as WEBTEMP*.xml. In this WEBTEMP*.xml file define your custom site definitions including the portal site

3.    The Template for the SPS is defined in WEBTEMPSPS. Xml under the configurationid = 20. Copy this template definition and paste it in your WEBTEMP*.xml. Set the ConfigurationID greater than 10000(Unique). Change the Template name as SPS* (the folder name which you created by copying the SPS folder) and change the title with your custom title if you want.

4.    The template for the portal site is defined in WEBTEMPSPS. Xml under the configurationid=47 with portalprovisioningprovider class. Copy this template definition and paste it in your WEBTEMP*.xml. Set the ConfigurationID as greater than 10000(Unique). Change the template name and title with your custom name (say SPSTEST) and title. You can erase the remaining template definition. Refer the following example to create WEBTEMP*. xml

<?xml version="1.0" encoding="utf-8"?>

<!-- _lcid="1033" _version="12.0.4518" _dal="1" -->

<!-- _LocalBinding -->

<Templates>

<Template Name="SPS*" ID="10001">

<Configuration ID="0" Title="My Site Definition" Hidden="FALSE" ImageUrl="/_layouts/images/blogprev.png"

Description="A Software Corporation site for a person or team to post ideas, observations, and expertise that site visitors can comment on."

              DisplayCategory="Custom" >

              </Configuration>

       </Template>

<Template Name="SPSTEST" ID="10002">

    <Configuration ID="0"

                             Title="My Collaboration Portal"

                             Type="0" Hidden="FALSE"

                             ImageUrl="/_layouts/1033/images/template_corp_intranet.png"

                             Description="A starter site hierarchy for an intranet divisional portal. It includes a home page, a News site, a Site Directory, a Document Center, and a Search Center with Tabs. Typically, this site has nearly as many contributors as readers and is used to host team sites."

                             ProvisionAssembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ProvisionClass="Microsoft.SharePoint.Publishing.PortalProvisioningProvider"

                   ProvisionData="sitetemplates//Webmanifest//portal*. xml"

                             RootWebOnly="FALSE"

                            

DisplayCategory="Custom">

   </Configuration>

 </Template>

5.    Create a copy of PORTALWEBMANIFEST. Xml in 12\Template\Site Templates\WebManifest and name it as PORTAL*. xml

6.     In PORTAL*. Xml, for the HOME(Portal)web, set the SiteDefinition as your Custom SPS* . For the remaining webs(sites under portal) set your custom site definition (if any) as shown below(See the commented lines for more)

<? xml version="1.0" encoding="utf-8"?>

<!-- _lcid="1033" _version="12.0.4518" _dal="1" -->

<!-- _LocalBinding -->

<portal xmlns="PortalTemplate.xsd">

    <!-- Here Define your portal site name and SiteDefinition name -->

    <web name="HomeNew" siteDefinition="SPS*" displayName="$Resources:cmscore,IPPT_Portal_Root_DisplayName;" description="$Resources:cmscore,IPPT_Portal_Root_Description;" >

        <webs>

        <!-- Here Define your Site name and site definition name which you want to create under the portal -->

            <web name="TEAM" siteDefinition="STS" displayName="My team" description="$Resources:spscore,PortalManifest_News_Description;" />

            <! -- Here the STS site definition is assigned to the Team Site. You can set your custom site definition for the sites -- >

        </webs>

    </web>

</portal>

7.    In WEBTEMP*.xml set the provisiondata path to the PORTAL*. xml path(Site Templates//Webmanifest//Portal*.xml)

8.    Save all the files and do an IISREST

9.    Now the Custom Site Definition will be available under Custom display category while creating a site. By using this template you can create your own Custom Portal Site.

Comments

  • Anonymous
    March 31, 2011
    Hi Syed, I need some clarification regarding the Publishing Site Template and Team site Template.Actually I need to create a site definition with publishing feature enabled and some content  types with list and custom columns.So I have decided to create a site definition with Team site as its much more easier. I have crated custom site definition and want to provision Sub Sites in that . Since team site will not come with publishing feature Is that possible for me to use Provision data attribute or else do i need to use only publishing sites.I have tried using this attribute with team sites and was successful as the sub site is getting created.But in Portal.xml where i define my structure. I have used a custom site definition configuration of CGSampleSTS#0 where team is my custom site definition name. When I am trying to create site from this . Its giving internet explorer cannot display the web site error. Please share your ideas of where I am going wrong. I am pasting here my portal.xml file for reference. <portal xmlns="PortalTemplate.xsd">  <web name="Home"       siteDefinition="CGSampleSTS#0"       displayName="Portal Home Page" description="Portal Home Site" >    <webs>      <web name="Wiki" siteDefinition="Wiki#0" displayName="Wiki Site for Project Site" description="Wiki Sub Site." />    </webs>  </web> </portal>