共用方式為


List Element (List)

Applies to: SharePoint Foundation 2010

Top-level element that contains the definition of a list.

<List
  BaseType = "Integer" | "Text"
  Default = "TRUE" | "FALSE"
  DefaultItemOpen = "Integer"
  Description = "Text"
  Direction = "Text"
  DisableAttachments = "TRUE" | "FALSE"
  DraftVersionVisibility = "Integer"
  EnableContentTypes = "TRUE" | "FALSE"  EnableMinorVersions = "TRUE" | "FALSE"  EnableThumbnails = "TRUE" | "FALSE"
  EventSinkAssembly = "Text"
  EventSinkClass = "Text"
  EventSinkData = "Text"
  FolderCreation = "TRUE" | "FALSE"
  Id = "GUID"
  ModeratedList = "TRUE" | "FALSE"
  ModerationType = "TRUE" | "FALSE"
  Name = "Text"
  OrderedList = "TRUE" | "FALSE"
  PrivateList = "TRUE" | "FALSE"
  QuickLaunchUrl = "URL"
  RootWebOnly = "TRUE" | "FALSE"
  ThumbnailSize = "Integer"
  Title = "Text"
  Type = "Integer"
  Url = "URL"
  URLEncode = "TRUE" | "FALSE"
  VersioningEnabled = "TRUE" | "FALSE" 
  WebImageHeight = "Integer"
  WebImageWidth = "Integer">
</List>

Attributes

Attribute

Description

BaseType

Optional Text. The BaseType attribute can be set to Integer, which stores values as integers, or to Text (default), which stores values as text. Note that it is not possible to create integer base-type choice fields.

Default

Optional Boolean. TRUE to specify that the list referenced in the Onet.xml file be created whenever a site is created. Otherwise, the list will not be created during site creation but will be available for later instantiation.

DefaultItemOpen

Optional Boolean. 1 to specify that applications which generate server transformations of items in the list open the items in a browser rather than in a separate client-side application; otherwise, 0.

Description

Optional Text. Provides a description for the list. This attribute must be specified within a configuration in an Onet.xml file when adding a custom list definition to a site definition. The value of this attribute overrides the value contained with the DefaultDescription element of a Schema.xml file.

Direction

Required Text. Specifies the direction of the reading order for the list. Possible values include RTL (right-to-left), LTR (left-to-right), or none.

DisableAttachments

Optional Boolean. TRUE to disable attachments in the list.

DraftVersionVisibility

Optional Integer. Specifies the rights that are required to see drafts. The following values are possible:

  • 1   Edit rights

  • 2   Approval rights

  • All other values   Read rights

EnableContentTypes

Optional Boolean. TRUE to enable management of content types in lists created through the list definition.

EnableMinorVersions

Optional Boolean.

EnableThumbnails

Optional Boolean. TRUE to specify that document parsers in this list generate thumbnail files that correspond to documents that are saved to this list. This attribute only applies to document libraries.

EventSinkAssembly

Optional Text. This option is specified only for schemas upgraded from Windows SharePoint Services 2.0. Specifies the strong name of a file in the Global Assembly Cache (GAC) that provides an event handler for document library events. For example, Microsoft.SharePoint, Version=11.0.0.0, Culture=Neutral, PublicKeyToken=71e9bce111e9429c This attribute has been deprecated in SharePoint Foundation.

EventSinkClass

Optional Text. Specifies the fully qualified, case-sensitive name of a class that defines an event handler for document library events in the form Namespace_Name.Class_Name. This attribute has been deprecated in SharePoint Foundation.

EventSinkData

Optional Text. Contains an arbitrary string for use by an event handler for document library events. This attribute has been deprecated in SharePoint Foundation.

FolderCreation

Optional Boolean. TRUE to display the New Folder command on the New menu.

Id

Optional GUID. Specifies the GUID of the list.

ModeratedList

Optional Boolean. TRUE to require content approval for submitted items.

ModerationType

Optional Boolean. TRUE to specify that the list has moderation enabled, requiring an approval process when content is created or modified.

Name

Required Text. The internal name of a list.

OrderedList

Optional Boolean. TRUE to specify that the option to allow users to reorder items in the list is available on the Edit View page for the list.

PrivateList

Optional Boolean. TRUE to specify that the list is private.

QuickLaunchUrl

Optional Text. Specifies the URL of the view page to open for the list through Quick Launch navigation.

RootWebOnly

Optional Boolean. TRUE to specify that the list created from the definition exists only in the root Web site of a site collection.

ThumbnailSize

Optional Integer. Specifies the width of thumbnails to display in picture libraries.

Title

Required Text. The generic display name of the list.

Type

Optional Integer. Specifies the list template type of the list. The following values are the default list template types.

  • 100   Generic list

  • 101   Document library

  • 102   Survey

  • 103   Links list

  • 104   Announcements list

  • 105   Contacts list

  • 106   Events list

  • 107   Tasks list

  • 108   Discussion board

  • 109   Picture library

  • 110   Data sources

  • 111   Site template gallery

  • 112   User Information list

  • 113   Web Part gallery

  • 114   List template gallery

  • 115   XML Form library

  • 116   Master pages gallery

  • 117   No-Code Workflows

  • 118   Custom Workflow Process

  • 119   Wiki Page library

  • 120   Custom grid for a list

  • 130   Data Connection library

  • 140   Workflow History

  • 150   Gantt Tasks list

  • 200   Meeting Series list

  • 201   Meeting Agenda list

  • 202   Meeting Attendees list

  • 204   Meeting Decisions list

  • 207   Meeting Objectives list

  • 210   Meeting text box

  • 211   Meeting Things To Bring list

  • 212   Meeting Workspace Pages list

  • 301   Blog Posts list

  • 302   Blog Comments list

  • 303   Blog Categories list

  • 1100   Issue tracking

  • 1200   Administrator tasks list

This attribute corresponds to the Type attribute of the ListTemplate element.

Url

Optional Text.

Specifies the path to the root of the directory that contains the ASPX files to which the list definition applies, relative to the root URL of the Web site.

URLEncode

Optional Boolean. TRUE to convert special characters, such as spaces, to quoted UTF-8 format, for example, %c3%ab for character ë.

VersioningEnabled

Optional Boolean. TRUE to specify within a Schema.xml file that versioning be enabled by default for document libraries created through the list definition. Setting this attribute has no effect on existing document libraries. If TRUE, versioning can still be disabled for a document library on the New Document Library page when the library is being created.

WebImageHeight

Optional Integer. Specifies the height, in pixels, of an image in a picture library.

WebImageWidth

Optional Integer. Specifies the width, in pixels, of an image in a picture library.

Child Elements

MetaData

Parent Elements

None

Occurrences

Minimum: 0

Maximum: 1

Remarks

When used as the root element in the schema file for a list, the List element must contain the Microsoft SharePoint Foundationows: namespace declaration. The following lines show the opening of a Schema.xml file for document libraries:

<List 
  xmlns:ows="Microsoft SharePoint" 
  Name="Documents" 
  Title="$Resources:shareddocuments_Title;" 
  Direction="$Resources:Direction;" 
  Url="Shared Documents" 
  BaseType="1">

In a list schema, the MetaData element contains the different parts of the list definition. Use an empty List element (<List />) to return the title of the current list.

In a site definition (Onet.xml), the List element does not contain a MetaData section, but it can contain a Data section through which to specify default column values for the given list type.