Understanding Schema.xml Files

Last modified: February 02, 2011

Applies to: SharePoint Foundation 2010

Each list definition that appears as an option on the Create page has a Schema.xml file that is located in a subfolder of %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES, or that is deployed as part of a sandboxed solution. The Schema.xml file defines the views, forms, toolbar, and special fields for lists that are created through the list definition.

You can perform the following kinds of tasks in a Schema.xml file to customize a list definition:

  • Add custom fields built on the base field types that are defined in FldTypes.xml (You cannot create custom base field types.)

  • Create a custom view for lists that are created through the list definition

  • Specify custom form pages for working with list items

  • Specify the default description that is displayed for the list in the user interface (UI)

Caution note Caution

Making changes to an originally installed Schema.xml file on a server that is running Microsoft SharePoint Foundation can break existing lists. The changes may be overwritten when you install updates or service packs for SharePoint Foundation, or when you upgrade an installation to the next product version. Create a custom list definition Feature instead of modifying original schema files. For more information, see How to: Create a Custom List Definition.

List Element

The top-level List element specifies the internal name and display name for the list definition, in addition to the direction of text that is used in lists, and the site-relative URL at which lists are created.

Note Note

In all the XML examples in this topic, strings that begin with "$Resources" are constants defined in a .resx file in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\Resources.

  xmlns:ows="Microsoft SharePoint" 

Like most attributes of the List element in Schema.xml, specification of the site-relative URL is largely irrelevant because it is overridden by list settings in the Onet.xml file of the site definition. This element optionally specifies Microsoft SharePoint as an XML namespace. The BaseType attribute specifies a base list type that is defined within the BaseTypes element of an Onet.xml file. Use the VersioningEnabled attribute to specify whether versioning is enabled by default for document libraries that are created through the list definition.

MetaData Element

The MetaData element groups list metadata within the List element and may contain the following subelements.

ContentTypes Element

The ContentTypes element specifies content types to associate with lists that are created through the list definition.

    <ContentTypeRef ID="0x0108">
      <Folder TargetName="Task" />
    <ContentTypeRef ID="0x0120" />
    <ContentTypeRef ID="0x012004" />

Fields Element

The Fields element contains field definitions for special fields that may be required in a list definition.

      <MAPPING Value="1">$Resources:core,Priority_High;</MAPPING>
      <MAPPING Value="2">$Resources:core,Priority_Normal;</MAPPING>
      <MAPPING Value="3">$Resources:core,Priority_Low;</MAPPING>

Each Field element specifies a display name (DisplayName), an internal name (Name), a field type (Type), and other field properties as required, that are defined in the FldTypes.xml file on which the field is based.

For a programming task that shows how to add a custom field to a Schema.xml file, see How to: Create a Custom List Definition.

Views Element

The Views element contains the definitions for views that are available by default when a list is created.

Note Note

SharePoint Foundation 2010 uses XSLT to define list views, and the View schema is maintained for backward compatibility. For information about XSLT list views, see List Views.

  <XslLink Default="TRUE">main.xsl</XslLink>
  <RowLimit Paged="TRUE">30</RowLimit>
  <Toolbar Type="Standard" />
    <FieldRef Name="LinkTitle"></FieldRef>
    <FieldRef Name="Status"></FieldRef>
    <FieldRef Name="Priority"></FieldRef>
    <FieldRef Name="DueDate"></FieldRef>
    <FieldRef Name="PercentComplete"></FieldRef>
      Location="Resource(wss,noXinviewofY_LIST)" />
        Location="Resource(wss,noXinviewofY_DEFAULT)" />
        <FieldRef Name="AssignedTo"></FieldRef>
        <Value Type="Integer">
          <UserID />
      <FieldRef Name="Status"></FieldRef>
      <FieldRef Name="Priority"></FieldRef>

Each View element specifies the type of format that is used in the display (usually HTML) and a unique ID for the view. When the view is displayed in a Web Part, the View element also specifies the title of the view. The Url attribute is used in list creation to specify the base name of the ASPX page in which the view is displayed. View also specifies the Web Part zone ID of the Web Part in which the view is displayed.

In SharePoint Foundation, the View element contains subelements that define various parts of a view:

  • The Aggregations element defines field references for calculated columns.

  • The XslLink element specifies an XSL file that defines the various parts of a view, including, for example, the header, body, and footer. It also defines the group-by sections, the rowsets that define how to display items when the number exceeds the row limit, and the view empty sections.

  • The RowLimit element specifies a limit on the number of rows, or items, to display.

  • The Toolbar element defines the area that is displayed above lists.

  • The ViewFields element specifies fields that are displayed in the view.

  • The ParameterBindings element specifies resource strings for implementation in XSLT. For more information, see XSLT Parameter Bindings.

  • The Query element defines a filter for the view.

Forms Element

The Forms element contains references to the forms that are used when users are working with individual list items.

  <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />

Each Form element specifies the form type, which can be DisplayForm, EditForm, or NewForm, and also the name of the ASPX page that is used for the form and the Web Part zone ID of the Web Part in which the form is displayed on the page.

DefaultDescription Element

A DefaultDescription element specifies the description that is displayed for the list definition in the UI.


This element is overridden by the Description attribute of the List element that corresponds to the current list definition that is specified within a configuration in Onet.xml.

Important noteImportant

A value for this element must be specified in custom list definitions.

Users create custom list templates on the Save as Template page for a list, or through code that uses the SaveAsTemplate method of the Microsoft.SharePoint.SPList class. When saved, a list template is stored as an .stp file in the List Template gallery of the top-level site in a site collection. List templates are available to all sites in the site collection that derive from the same site definition and language as the site on which the list was originally created. To make a list template available to a site in another site collection, download the template from its current gallery and then upload it to the gallery of the new site collection.