About Me

Having 12 years experience in Microsoft technologies.Since more than 7 years working in SharePoint technologies. Expert in providing consultation for SharePoint projects. Hands on with development and administration.

Wednesday, 11 December 2013

Create custom site definition in SharePoint Server 2010


 In this article I am explaining the steps to create a SharePoint 2010 custom site definition by copying an existing site definition. The steps involved in this are not much different then the last versions on SharePoint.You only need to change in two schema files. First file is the copy of WEBTEMP xml file and second is copy of onet.xml file.


For copying existing site definition, you first need to know the location of the existing site definitions. Site definitions are located in the following folder in the SharePoint server 14 hive:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteTemplates 
Each site definition has its own sub directory under this folder. The sub directory contains the .aspx pages, images, and one onet.xml file. onet.xml file contains the configuration and modules informations of that particular site definition. WEBTEMP xml file contains the registration information of the Site Definition with SharePoint. Actual name of WEBTEMP file would be like WEBTEMP_<Name of Site Definition>.xml. WEBTEMP file are located in the following location:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\1033\XML

Steps Involved

1. Clone an existing site definition folder located in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteTemplates\ directory.

2. Give it any name that contains no spaces. For example, to create a custom site definition that derives from the blank site definition for Windows SharePoint Services, copy the \sts folder.
3. Rename the copy of sts folder to MyTestSite.

4. Make a copy of the WebTemp.xml file that is located in C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\1033\XML.

5. Rename the copied file to WEBTEMP_MyTestSite.xml

6. Open WEBTEMP_MyTestSite.xml using Vishal Studio 2010 or some other editor to do the customization. It contains a collection of Template elements and Configuration subelements. The Configuration element defines the title, description, URL for the image displayed in the user interface, and a display category that specifies the tab on which to display the template in the Template Selection section of the New SharePoint Site page. "My Custom Site Definition" in this example.
<?xml version="1.0" encoding="utf-8"?>

   <Templates xmlns:ows="Microsoft SharePoint">

      <Template Name="MyTestSite" ID="10005">

         <Configuration ID="0" Title="MyTestSite Template" Hidden="FALSE" ImageUrl="" 
            Description="This template is used for initializing a new site." 
            DisplayCategory="My Custom Site Definition"></Configuration>



Note: In each Template element defined in the WebTemp file, the Name attribute must contain the same name that is assigned to the new folder. In this example it is "MyTestSite". Also, to avoid conflict with IDs already used in Windows SharePoint Services, use unique values greater than 10,000 for the ID attribute. I am using ID = 10005 in this example.
7. Reset the IIS. (Open command prompt. Type iisreset and press enter key.)

8. Open Central Administration and goto Application Management -> Create Site Collection. A new tab will appear.

9. Select the site template you created. Enter Title and Url and click on Create button.

Your new sharepoint site is created.

1 comment:

  1. Helpful data shared. I am extremely happy to read this write-up. thanks for giving us good info. Great walk-through. I appreciate this post.
    SharePoint Online Training