List Definition

Defines the schema for a SharePoint list.

Real World Example

A portal site owner wants a common list structure that uses custom content types and views for project-item tracking in multiple Web sites, but the built-in lists are not suitable. A consultant for SharePoint Products and Technologies develops a new list definition feature that will be activated on each Web site that requires the list.

Technical Details

List definitions in earlier versions of SharePoint Products and Technologies were contained directly within site definitions. In Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0, list definitions are implemented by using Features containing the required schema of the list, and are then referenced from site definitions or added later by activating a Feature within a Web site.

Following is an example of a simple list definition from the Windows SharePoint Services 3.0 SDK.

<List Name="SimpleList" Title="Simple List" BaseType="0" Direction="" Url="">
   <MetaData>
      <Fields>
         <Field Type="Choice" Name="FavoriteColor" DisplayName="Favorite Color">
            <CHOICES>
               <CHOICE>Red</CHOICE>
               <CHOICE>Green</CHOICE>
               <CHOICE>Blue</CHOICE>
            </CHOICES>
         </Field>
      </Fields>
      <Views>
         <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
            <ViewFields>
               <FieldRef Name="DocIcon"/>
               <FieldRef Name="Attachments"/>
               <FieldRef Name="LinkTitle"/>
               <FieldRef Name="FavoriteColor"/>
            </ViewFields>
         </View>
      </Views>
   </MetaData>
</List>

Support Details

Lists are a basic location for data storage within Office SharePoint Server 2007 and Windows SharePoint Services 3.0, so adoption of new lists involves maintaining those list definitions through to newer versions of the SharePoint Products and Technologies line, or else migrating potentially large amounts of content to other lists in the future. Additionally, making changes to a list schema in a site definition after it is already adopted could lead to issues with existing sites or during upgrades and is unsupported.