Share via


How to: Use Site Definition Configurations

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

If you are creating a site definition, site definition configurations allow you to specify which lists to include in the creation of a site. Through site definition configurations, you can reuse existing list definitions in the Onet.xml file for a given site definition, which prevents you from having to copy or recode list definitions. You can create multiple configurations in one Onet.xml file; each configuration can enable the creation of a site with a different set of lists.

To set up a site definition configuration within a site definition, use Configuration elements within a custom WebTemp.xml file and within one or more Onet.xml files that are referenced in the WebTemp file. For information on how to create a custom WebTemp*.xml file, see How to: Create a Custom Site Definition and Configuration.

Example

The following WebTemp.xml file uses two Configuration elements to define different site definition configurations for instantiating a site, one for a Research Collaboration site and the other for a Research Document Workspace site. This example uses only two configurations within a single site definition, but you can include multiple site definitions, each with multiple configurations, within a single WebTemp.xml file. Each site definition references a different site definition folder and its Onet.xml file.

<?xml version="1.0" encoding="utf-8" ?>
<Templates xmlns:ows="Microsoft SharePoint">
  <Template Name="RESEARCH" ID="10001">
    <Configuration ID="0" Title="Research Collaboration site" 
      Hidden="FALSE" ImageUrl="_layouts/images/stsprev.jpg" 
      Description="This definition creates a site for the Research 
      team to create, organize, and share general information." 
      DisplayCategory="Collaboration">
    </Configuration>
    <Configuration ID="1" Title="Research Workspace" Hidden="FALSE" 
      ImageUrl="_layouts/images/dwsprev.jpg" Description="This 
      definition creates a site for Research team colleagues to 
      work together on specific documents." 
      DisplayCategory="Collaboration">
    </Configuration>
  </Template>
</Templates>

As indicated by the value of the Name attribute in the Template element, this example assumes that a site definition directory named "RESEARCH" exists. If a WebTemp*.xml file specifies more than one site definition, the definitions are distinguished by their unique ID values. (To avoid conflict with current or future Microsoft-supplied site definitions, use ID values above 10000 for all your custom site definitions.)

Each Configuration element also contains an ID attribute. The combination of this ID and the value of the Name attribute in the Template element provides a reference to the contents of a specific Configuration element in a specific Onet.xml file. In the example, the Name attribute contains RESEARCH and the ID attributes contain 0 and 1, which reference the RESEARCH site definition and configurations with IDs of 0 or 1 in Onet.xml.

Note

In the Windows SharePoint Services 3.0 object model, a site definition configuration and its parent site definition are represented by a Microsoft.SharePoint.SPWebTemplate object. That object's Name property concatenates the definition name and the configuration ID with a "#" symbol in between them. So, the two site definition configurations in the preceding example would be named "RESEARCH#0" and "RESEARCH#1".

In the Onet.xml file, each site definition configuration defines a specific type of site that can be created from the site definition. All configurations within this file share a set of available list definitions, document templates, navigation areas, base list types, and modules that are defined within the file. You can add a reference to a list that is defined in Onet.xml by adding a List element to the collection of lists specified within a Configuration element. For example, if you define a list type named "My_Custom_List" in Onet.xml with a Type attribute of 10001, you can add <List Title="My_Custom_List" Type="10001" Url="Lists/My_Custom_List" /> to make the list part of the configuration. The following example shows the arrangement of configurations in an Onet.xml file.

<Configurations>
  <Configuration ID="0" Name="RC">
    <Lists>
      <List FeatureId="00BFEA71-E717-4E80-AA17-D0C71B360101" 
        Type="101" Title="$Resources:core,shareddocuments_Title;" 
        Url="$Resources:core,shareddocuments_Folder;" 
        QuickLaunchUrl="$Resources:core,shareddocuments_Folder;/Forms/AllItems.aspx" /> 
      <List FeatureId="00BFEA71-6A49-43FA-B535-D15C05500108" 
        Type="108" Title="$Resources:core,discussions_Title;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,discussions_Folder;" 
        QuickLaunchUrl="$Resources:core,lists_Folder;/$Resources:core,discussions_Folder;/AllItems.aspx" 
        EmailAlias="$Resources:core,discussions_EmailAlias;" /> 
      <List FeatureId="00BFEA71-D1CE-42de-9C63-A44004CE0104" 
        Type="104" Title="$Resources:core,announceList;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;">
        <Data>
          <Rows>
            <Row>
              <Field Name="Title">$Resources:onetid11;</Field> 
              <Field Name="Body">$Resources:onetid12;</Field> 
              <Field Name="Expires"><ows:TodayISO/></Field> 
            </Row>
          </Rows>
        </Data>
      </List>
      <List FeatureId="00BFEA71-2062-426C-90BF-714C59600103" 
        Type="103" Title="$Resources:core,linksList;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,links_Folder;" /> 
      <List FeatureId="00BFEA71-EC85-4903-972D-EBE475780106" 
        Type="106" Title="$Resources:core,calendarList;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;" 
        QuickLaunchUrl="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;/Calendar.aspx" 
        EmailAlias="$Resources:core,calendar_EmailAlias;" /> 
      <List FeatureId="00BFEA71-A83E-497E-9BA0-7A5C597D0107" 
        Type="107" Title="$Resources:core,taskList;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,tasks_Folder;" 
        QuickLaunchUrl="$Resources:core,lists_Folder;/$Resources:core,tasks_Folder;/AllItems.aspx" /> 
    </Lists>
    <Modules>
      <Module Name="Default" /> 
    </Modules>
    <SiteFeatures>
      <Feature ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57" /> 
    </SiteFeatures>
    <WebFeatures>
      <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" /> 
    </WebFeatures>
  </Configuration>
  <Configuration ID="1" Name="RDW">
    <Lists>
      <List FeatureId="00BFEA71-E717-4E80-AA17-D0C71B360101" 
        Type="101" Title="$Resources:core,shareddocuments_Title;" 
        Url="$Resources:core,shareddocuments_Folder;" /> 
      <List FeatureId="00BFEA71-6A49-43FA-B535-D15C05500108" 
        Type="108" Title="$Resources:core,discussions_Title;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,discussions_Folder;" 
        QuickLaunchUrl="$Resources:core,lists_Folder;/$Resources:core,discussions_Folder;" /> 
      <List FeatureId="00BFEA71-D1CE-42de-9C63-A44004CE0104" 
        Type="104" Title="$Resources:core,announceList;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;">
        <Data>
          <Rows>
            <Row>
              <Field Name="Title">$Resources:onetid11;</Field> 
              <Field Name="Body">$Resources:onetid12;</Field> 
              <Field Name="Expires"><ows:TodayISO/></Field> 
            </Row>
          </Rows>
        </Data>
      </List>
      <List FeatureId="00BFEA71-2062-426C-90BF-714C59600103" 
        Type="103" Title="$Resources:core,linksList;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,links_Folder;" /> 
      <List FeatureId="00BFEA71-EC85-4903-972D-EBE475780106" 
        Type="106" Title="$Resources:core,calendarList;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;" 
        QuickLaunchUrl="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;/Calendar.aspx" /> 
      <List FeatureId="00BFEA71-A83E-497E-9BA0-7A5C597D0107" 
        Type="107" Title="$Resources:core,taskList;" 
        Url="$Resources:core,lists_Folder;/$Resources:core,tasks_Folder;" /> 
    </Lists>
    <Modules>
      <Module Name="DWS" /> 
    </Modules>
    <SiteFeatures>
      <Feature ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57" /> 
    </SiteFeatures>
    <WebFeatures>
      <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" /> 
    </WebFeatures>
  </Configuration>
</Configurations>

The value of the ID attribute for each Configuration element corresponds to the IDs specified in the WebTemp.xml file for configurations. In this example, the default site is a "Research Collaboration" site (0), and not a "Research Document Workspace" site (1). The Type attribute for each List element references a list type defined in Onet.xml. The Url attribute contains the URL for the folder containing the list definition for each list, which includes the ASPX files, Schema.xml, and any related files. When specified, the QuickLaunchUrl attribute contains the full path to the AllItems.aspx file for a list, which displays the list in the Quick Launch area.

Warning

You must create a custom site definition by copying an existing site definition, rather than modifying the original files installed with Windows SharePoint Services. Changes that you make to originally installed files may be overwritten when you install updates or service packs for Windows SharePoint Services, or when you upgrade an installation to the next product version. For information on creating a custom site definition, see How to: Create a Custom Site Definition and Configuration.