0 out of 2 rated this helpful - Rate this topic

File Element (Module)

Published: May 2010

Specifies a file to include within a module in a site definition.


<File
  DocumentTemplateForList = string
  DoGUIDFixUp = "TRUE" | "FALSE"
  IgnoreIfAlreadyExists = "TRUE" | "FALSE"
  Level = Draft
  Name = string
  NavBarHome = "TRUE" | "FALSE"
  Path = string
  Type = "Ghostable" | "GhostableInLibrary"
  Url = string>
  <AllUsersWebPart />
  <BinarySerializedWebPart />
  <NavBarPage />
  <Property />
  <View />
  <WebPartConnection />
</File>

Attribute

Description

IgnoreIfAlreadyExists

Optional Boolean. TRUE to provision the view even if the file aready exists at the specified URL; otherwise, FALSE.

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\Features\Feature. 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 Web server. Possible values include Ghostable and GhostableInLibrary. Both values specify that the file be cached, but GhostableInLibrary specifies that the file be cached as part of a list whose base type is DocumentLibrary.

When changes are made, for example, to the home page through the UI, only the differences from the original page definition are stored in the database, while default.aspx is cached in memory along with the schema files. The HTML page that is displayed in the browser is constructed through the combined definition resulting from the original definition cached in memory and from changes 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

Minimum: 0

Maximum: Unbounded

For an example of how this element is used, see Modules.

Date

Description

Reason

May 2010

Initial publication

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
IgnoreIfAlreadyExists modification
Optional Boolean. TRUE to NOT throw an error if the file aready exists at the specified URL; otherwise, FALSE
Level attribute
This documentation lacks listing the possible values for the Level attribute. By default this will be Draft which obviously means the page will be unpublished and thus only visible to editors. You can also enter Published as the value for level to directly publish the page and make it available for everybody to see.

By default (if don't specify this attribute) the page will be published (approved).
Path modification
The description for the Path attribute on this page is incorrect. It should point to the relative path of the file you wish to provision within your Visual Studio solution.

I.e. if your solution contains a module Pages which contains a file named Home.aspx, the path attribute in elements.xml within your Pages module should read: <File Path="Pages\Home.aspx" ... >
IgnoreIfAlreadyExists modification
The description of IgnoreIfAlreadyExists should read:
TRUE
to provision the file even if the file aready exists at the specified URL;