共用方式為


File Element (Site)

Applies to: SharePoint Foundation 2010

Specifies a file to include within a module in a site definition configuration or Web template configuration.

<File
  DocumentTemplateForList = "Text"  DoGUIDFixUp = "TRUE" | "FALSE"
  IgnoreIfAlreadyExists = "TRUE" | "FALSE"
  Level = "Text"
  Name = "Text"
  NavBarHome = "TRUE" | "FALSE"
  Path = "Text"
  Type = "Text"
  Url = "Text >
</File>

Attributes

Attribute

Description

DocumentTemplateForList

Optional Text.

DoGUIDFixUp

Optional Boolean.

IgnoreIfAlreadyExists

Optional Boolean.

Level

Optional Text.

Name

Optional Text. Specifies the virtual path for the file. Cannot contain the following characters:

  • \"

  • #

  • %

  • &

  • *

  • :

  • <

  • >

  • ?

  • \\

  • {

  • }

  • |

  • ~

  • \x7f

NavBarHome

Optional Boolean. TRUE if the file is the destination URL for the Home link in the top navigation bar used throughout the site.

Path

Optional Text. Specifies the physical path to the file relative to %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteTemplates\Site_Definition for Onet.xml files. Specifies the physical path to the file relative to %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES\Feature_Name for Feature.xml files. Can only contain the following characters:

  • alphanumeric

  • hyphen (-)

  • underscore (_)

  • period (.)

  • space ( )

Type

Optional Text. Specifies that the file be cached in memory on the front-end server. Possible values include Ghostable and GhostableInLibrary. Both values specify that the file will be cached, but GhostableInLibrary specifies that the file will be cached as part of a list whose base type is DocumentLibrary.

For example, when changes are made to a home page through the user interface (UI), only the differences between the original page definition and the new page are stored in the database. The default.aspx is cached in memory, in addition to the schema files. The HTML page that is displayed in the browser is constructed through the combined page definition that results from the original page definition that is cached in memory and from changes that are stored in the database.

Url

Required Text. Specifies the virtual path for the file. If the Name attribute is specified, its value is used for the virtual path. If Path is not specified, the value of Url is used for the physical path. Cannot contain the following characters:

  • \"

  • #

  • %

  • &

  • *

  • :

  • <

  • >

  • ?

  • \\

  • {

  • }

  • |

  • ~

  • \x7f

Child Elements

AllUsersWebPart, BinarySerializedWebPart, NavBarPage, Property, View, WebPartConnection

Parent Elements

Module

Occurrences

Minimum: 0

Maximum: Unbounded

Remarks

See Module Element (Site) for an example that uses the File element.