Partager via


Onet.xml

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.

When you install Windows SharePoint Services 3.0, six Onet.xml files are placed within the setup directory, one in \Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\GLOBAL\XML that applies globally to the deployment, and five in different folders within ...\TEMPLATE\SiteTemplates that apply to each of the five site definitions that ship with Windows SharePoint Services 3.0. They are Blog sites, the central administration site, Wiki sites, Meeting Workspace sites, and team SharePoint sites. Only the last two of these families contain more than one site definition configuration in Windows SharePoint Services 3.0.

The global Onet.xml file defines list templates for hidden lists, list base types, a default definition configuration, and modules that apply globally to the deployment. The five Onet.xml files in the \SiteTemplates directory define navigational areas, list templates, document templates, configurations, modules, components, and server e-mail footer sections used in the five site definitions.

Functions of Onet.xml

Depending on its particular use, an Onet.xml file can serve multiple functions, such as the following:

  • Define the top and side navigation areas that appear on the home page and in list views for a site definition.

  • Specify the list definitions that are used in each site definition and whether they are available for creating lists on the Create page.

  • Specify document templates that are available in the site definition for creating document library lists on the New page, and specify the files used in the document templates.

  • Define the base list types from which default Windows SharePoint Services lists are derived. (Only the global Onet.xml file serves this function.)

  • Specify the configurations of lists and modules that are used within each site definition.

  • Specify Windows SharePoint Services components.

  • Define the footer section used in server e-mail.

Web Site Definition Tasks with Onet.xml

The following kinds of tasks can be performed in a custom Onet.xml to create a custom site definition:

  • Specify an alternate cascading style sheet (CSS) file, JavaScript file, or ASPX header file for a site definition.

  • Modify navigation areas for the home page and list pages.

  • Add a list definition as an option to the Create page.

  • Add a document template for creating document libraries.

  • Define one or more configurations for the site definition, specifying the lists, modules, files, and Web Parts that are included when a site definition configuration is instantiated.

Warning

Making changes to an originally installed Onet.xml file on a server running Windows SharePoint Services can break existing sites, and the changes 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. Always create a new Onet.xml; do not modify the original file. For more information, see How to: Create a Custom Site Definition and Configuration.

File Format

The following sections define the various elements of the Onet.xml file.

Project Element

The top-level Project element specifies a default name for sites that are created through any of the site configurations in the site definition and specifies the directory that contains subfolders in which the files for each list definition reside.

Note

Unless indicated otherwise, excerpts used in the following examples are taken from the Onet.xml file for the STS site definition.

<Project 
  Title="$Resources:onet_TeamWebSite;" 
  Revision="2"
  ListDir="$Resources:core,lists_Folder;" 
  xmlns:ows="Microsoft SharePoint">

Note

In all the excerpts in this topic, the strings that begin with "$Resources" are constants that are defined in an .resx file. For example, "$Resources:onet_TeamWebSite" is defined in core.resx as "Team Site". When you create a custom Onet.xml file, you can use literal strings.

This element can also have an AlternateCSS attribute that specifies an alternate CSS file for style definitions, a CustomJSUrl attribute specifies an alternate JavaScript file for custom script, and an AlternateHeader attribute specifies an ASPX file for alternate headers.

The Project element does not contain any attribute identifying the site definition that it defines. Each Onet.xml is associated with a site definition by virtue of the directory path in where it resides, which (except for the global Onet.xml) is Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\SiteTemplates\site_type\XML\ , where site_type is the name of the site definition, such as STS or MPS.

The NavBars element contains definitions for the top navigation area that is displayed on the home page or in list views, and definitions for the side navigation area that is displayed on the home page.

Note

A NavBar is not necessarily a toolbar. It can be, for example, a tree of links.

<NavBars>
  <NavBar 
    Name="$Resources:core,category_Top;" 
    Separator="&amp;nbsp;&amp;nbsp;&amp;nbsp;" 
    Body="&lt;a ID='onettopnavbar#LABEL_ID#' href='#URL#' accesskey='J'&gt;#LABEL#&lt;/a&gt;" 
    ID="1002" />
  <NavBar 
    Name="$Resources:core,category_Documents;" 
    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="1004" />
    ...
</NavBars>

A NavBarLink element defines links for the top or side navigational area, and an entire NavBar section groups new links in the side area. Each NavBar element specifies a display name and a unique ID for the navigation bar, and defines how to display the navigation bar.

For information on customizing the navigation areas on Windows SharePoint Services pages, see Customizing Site Navigation.

ListTemplates Element

The ListTemplates section specifies the list definitions that are part of a site definition.

Note

The ListTemplates section is not included in the Onet.xml file of the standard Windows SharePoint Services site definition, which instead uses list definition Features and element .xml files to define its list templates. The following example is taken from the Onet.xml file for the Meetings Workspace site definition.

<ListTemplates>
  <ListTemplate 
    Name="meetings" 
    DisplayName="$Resources:xml_onet_mwsidmeetingDisp;" 
    Type="200" 
    BaseType="0" 
    Unique="TRUE" 
    Hidden="TRUE" 
    HiddenList="TRUE" 
    DontSaveInTemplate="TRUE" 
    SecurityBits="11" 
    Description="$Resources:xml_onet_mwsidmeetingDesc;" Image="/_layouts/images/itevent.gif">
  </ListTemplate>
  <ListTemplate 
    Name="agenda" 
    DisplayName="$Resources:xml_onet_mwsidagendaDisp;" 
    Type="201" 
    BaseType="0" 
    FolderCreation="FALSE" 
    DisallowContentTypes="TRUE" 
    SecurityBits="11" 
    Description="$Resources:xml_onet_mwsidagendaDesc" 
    Image="/_layouts/images/itagnda.gif">
  </ListTemplate>
    ...
</ListTemplates>

Each ListTemplate element specifies an internal name that identifies the list definition. The ListTemplate element also specifies a display name for the list definition and whether the option to add a link on the Quick Launch bar appears selected by default on the New page. In addition, this element specifies the description of the list definition and the path to the image representing the list definition, which are both displayed on the Create page. If Hidden="TRUE" is specified, the list definition does not appear as an option on the Create page.

The ListTemplate element has two attributes for type, Type and BaseType. The Type attribute specifies a unique identifier for the list definition, while BaseType identifies the base list type for the list definition and corresponds to the Type value specified for one of the base list types defined within the global ONET.XML file (\TEMPLATE\GLOBAL\XML).

For a programming task that shows how to add a list template, see How to: Create a Custom List Definition.

DocumentTemplates Element

The DocumentTemplates section defines the document templates that are listed on the New page.

<DocumentTemplates>
  ...
  <DocumentTemplate 
    Path="STS" 
    DisplayName="$Resources:core,doctemp_Word;" 
    Type="121" 
    Default="TRUE" 
    Description="$Resources:core,doctemp_Word_Desc;">
    <DocumentTemplateFiles>
      <DocumentTemplateFile 
        Name="doctemp\word\wdtmpl.dotx" 
        TargetName="Forms/template.dotx" 
        Default="TRUE" />
    </DocumentTemplateFiles>
  </DocumentTemplate>
  ...
</DocumentTemplates>

Each DocumentTemplate element specifies a display name, a unique identifier, and a description for the document template. If Default is set to TRUE, the template is the default template selected for document libraries that are created in sites created with a configuration in the site definition that the Onet.xml is specifying. Despite its singular name, a DocumentTemplate element actually can contain a collection of DocumentTemplateFile elements. The Name attribute of each DocumentTemplateFile element specifies the relative path to a local file that serves as the template. The TargetName attribute specifies the destination URL of the template file when a document library is created. The Default attribute specifies whether the file is the default template file.

For a programming task involving document templates, see How to: Add a Document Template, File Type, and Editing Application to a Site Definition.

BaseTypes Element

The BaseTypes element of the global Onet.xml file is used during site or list creation to define the five list types on which all list definitions in Windows SharePoint Services are based. Each list template that is specified in the list templates section is identified with one of the base types: Generic List, Document Library, Discussion Forum, Vote or Survey, or Issues List.

Note

In Windows SharePoint Services 3.0 the BaseTypes section is implemented only in the global Onet.xml file (\TEMPLATE\GLOBAL\XML), from which the following example is taken.

<BaseTypes>
  <BaseType 
    Title="Generic List" 
    Image="/_layouts/images/itgen.gif" 
    Type="0">
      <MetaData>
        <Fields>
          <Field 
            ID="{1d22ea11-1e32-424e-89ab-9fedbadb6ce1}" 
            ColName="tp_ID" 
            RowOrdinal="0" 
            ReadOnly="TRUE" 
            Type="Counter" 
            Name="ID" 
            PrimaryKey="TRUE" 
            DisplayName="$Resources:core,ID" 
            SourceID="http://schemas.microsoft.com/sharepoint/v3" 
            StaticName="ID">
          </Field>
          <Field 
            ID="{03e45e84-1992-4d42-9116-26f756012634}" 
            RowOrdinal="0" 
            Type="ContentTypeId" 
            Sealed="TRUE" 
            ReadOnly="TRUE" 
            Hidden="TRUE" 
            DisplayName="$Resources:core,Content_Type_ID;"
            Name="ContentTypeId" 
            DisplaceOnUpgrade="TRUE"
            SourceID="http://schemas.microsoft.com/sharepoint/v3" 
            StaticName="ContentTypeId" 
            ColName="tp_ContentTypeId">
          </Field>
          ...
      </Fields>
    </MetaData>
  </BaseType>
  ...
</BaseTypes>

Each BaseType element specifies the fields used in lists that are derived from the base type. The Type attribute of each Field Element (List - Definition) element identifies the field with a field type that is defined in FldTypes.xml.

Warning

Do not modify the contents of the global Onet.xml file (file (\TEMPLATE\GLOBAL\XML), because doing so can break the installation. Base list types cannot be added. For information on how to add a list definition, see How to: Create a Custom List Definition.

Configurations Element

Each Configuration element in the Configurations section specifies the lists and modules that are created by default when the site definition configuration is instantiated.

<Configurations>
  ...
  <Configuration 
    ID="0" 
    Name="Default">
    <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" />
      ...
    </Lists>
    <Modules>
      <Module 
        Name="Default" />
    </Modules>
    <SiteFeatures>
      <Feature 
        ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57" />
      <Feature 
        ID="FDE5D850-671E-4143-950A-87B473922DC7" />
    </SiteFeatures>
    <WebFeatures>
      <Feature 
        ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" />
      <Feature 
        ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4" />
    </WebFeatures>
  </Configuration>
  ...
</Configurations>

The ID attribute identifies the configuration (uniquely relative to the other configurations in the site definition) and corresponds to the ID attribute of a Configuration element in WebTemp.xml.

Each List element specifies the title of the list definition and the URL for where to create the list. The QuickLaunchUrl attribute can be used to set the URL of the view page to use when adding a link in the Quick Launch to a list created from the list definition. The value of the Type attribute corresponds to the Type attribute of a template in the list templates section. Each Module element specifies the name of a module defined in the modules section.

The SiteFeatures and WebFeatures elements contain references to site collection and site–scoped Features to include in the site definition.

For post-processing capabilities, use an ExecuteUrl element within a Configuration element to specify the URL that is called following instantiation of the site.

For more information on definition configurations, see How to: Use Site Definition Configurations.

Modules Element

The Modules collection specifies the modules to include by default in creating a site collection. Each Module element in turn specifies one or more files to include, often for Web Parts, which are cached in memory on the front-end Web server along with the schema files. You can use the Url attribute of the Module element to provision a folder as part of the site definition.

<Modules>
  <Modules>
    <Module 
      Name="Default" 
      Url="" 
      Path="">
      <File 
        Url="default.aspx" 
        NavBarHome="True">
        <View 
          List="$Resources:core,lists_Folder;
          /$Resources:core,announce_Folder;" 
          BaseViewID="0" 
          WebPartZoneID="Left" />
        <View 
          List="$Resources:core,lists_Folder;
          /$Resources:core,calendar_Folder;" 
          BaseViewID="0" 
          RecurrenceRowset="TRUE" 
          WebPartZoneID="Left" 
          WebPartOrder="2" />
        <AllUsersWebPart 
          WebPartZoneID="Right" 
          WebPartOrder="1"><![CDATA[<WebPart 
            xmlns="http://schemas.microsoft.com/WebPart/v2"
            xmlns:iwp="http://schemas.microsoft.com
            /WebPart/v2/Image">
            <Assembly>Microsoft.SharePoint, Version=12.0.0.0, 
              Culture=neutral, 
              PublicKeyToken=71e9bce111e9429c</Assembly>
            <TypeName>Microsoft.SharePoint.WebPartPages.ImageWebPart
            </TypeName>
            <FrameType>None</FrameType>
            <Title>$Resources:wp_SiteImage;</Title>
            <iwp:ImageLink>/_layouts/images/homepage.gif
            </iwp:ImageLink>
            <iwp:AlternativeText>$Resources:core,sitelogo_wss;
            </iwp:AlternativeText>
            </WebPart>]]>
        </AllUsersWebPart>
        <View 
          List="$Resources:core,lists_Folder;
          /$Resources:core,links_Folder;" 
          BaseViewID="0" 
          WebPartZoneID="Right" 
          WebPartOrder="2" />
          <NavBarPage 
            Name="$Resources:core,nav_Home;" 
            ID="1002" 
            Position="Start" />
          <NavBarPage 
            Name="$Resources:core,nav_Home;" 
            ID="0" 
            Position="Start" />
      </File>
    </Module>
  ...
</Modules>

The Module element specifies a name for the module, which corresponds to a module name that is specified within a configuration in ONET.XML.

The Url attribute of each File element in a module specifies the name of a file to create when a site is created. When the module includes a single file, such as default.aspx, NavBarHome="TRUE" specifies that the file will serve as the destination page for the Home link in navigation bars. The File element for default.aspx also specifies the Web Parts to include on the home page and information about the home page for other pages that link to it.

For more information about using modules in Windows SharePoint Services 3.0, see How to: Provision a File.

Components Element

The Components element specifies components to include in sites created through the definition.

<Components>
  <FileDialogPostProcessor ID="BDEADEE4-C265-11d0-BCED-00A0C90AB50F" />
</Components>

ServerEmailFooter Element

The ServerEmailFooter element specifies the footer section used in email sent from the server.

<ServerEmailFooter>$Resources:ServerEmailFooter;</ServerEmailFooter>

See Also

Concepts

Site Schema

Guidelines for Using Custom Site Definitions, Configurations, and Templates