Partager via


Creating a Site Definition from an Existing Site Definition

You can create a site definition by copying and modifying an existing site definition. This task involves use of Collaborative Application Markup Language (CAML) in two schema files: one that is a copy of a WEBTEMP.XML file, and the other a copy of an ONET.XML file. It is required that you create a site definition as described in this topic rather than modifying the originally installed WEBTEMP.XML file.

  • Copy the existing site definition folder located in the Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\Template\1033 directory.

    For example, to create a custom site definition that derives from the site definition for Microsoft Windows SharePoint Services, copy the STS folder located in the 1033 directory. Name the new folder using all capital letters.

  • Make a copy of the WEBTEMP.XML file located at Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\XML.

    Give the file a unique name by appending a string to the name of the original file; for example, WEBTEMPACTION.XML. At run time, the compiler merges information contained in this file with the information contained in the original file in order to specify which site templates are available for creating new sites.

  • Customize the contents of the new WEBTEMP file.

    Each WEBTEMP.XML file contains a collection of Template elements and Configuration subelements, which identify to the compiler all the site definitions that can be instantiated. The Configuration element defines a title, a description, and a URL for the image displayed in the user interface, properties common to each Web site created using the site definition.

    Important  In each Template element defined in the WEBTEMP file, the Name attribute must contain the same name, in all capital letters, that is assigned to the new folder. Also, in order to avoid conflict with IDs already used in Windows SharePoint Services, use unique values greater than 10,000 for the ID attribute.

    The following example defines a single site definition. The example assumes the existence of an ACTIONCOMMITTEE directory that has been created as previously described.

    <?xml version="1.0" encoding="utf-8" ?>
    <Templates xmlns:ows="Microsoft SharePoint">
       <Template Name="ACTIONCOMMITTEE" ID="98">
          <Configuration ID="0" Title="Action Committee Team Site" Type="0" Hidden="FALSE"
             ImageUrl="images/stsprev.jpg" Description="This template provides a forum
             for the team to create, organize, and share information quickly and easily. It includes a
             Document Library, and basic lists such as Announcements, Events, Contacts, and Quick Links.">
          </Configuration>
       </Template>
    </Templates>
    
  • Save the file.

  • You may need to reset Internet Information Services (IIS) for the new template to appear as an option on the Template Selection page.