File Element (Site)

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.

Specifies a file to include within a module in a site definition, or a file and its meta-information in the Manifest.xml file for a custom site template.

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

Attributes

Attribute

Description

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 \\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\Site_Definition for Onet.xml files. Specifies the physical path to the file relative to \\Program Files\Common Files\Microsoft Shared\web server extensions\12\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, NavBarPage, Property, View

Parent Elements

Module

Occurrences

Minimum: 0

Maximum: Unbounded

Remarks

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