Partager via


File Element

The File element 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..

Syntax

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

Attributes

Name Description
Name Optional Text. Specifies a name for the file.
NavBarHome Optional Boolean. TRUE if the file is the destination URL for the Home link in the top navigation bar used throughout the site.
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 be cached, but GhostableInLibrary specifies that the file be cached as part of a list whose base type is Document Library.

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 URL for the file.

Element Relationships

Parent Elements Child Elements
Module AllUsersWebPart, NavBarPage, View

Example

The following example from the ONET.XML file uses the File element to define the default home page.

<Module Name="Default" Url="" Path="">
   <File Url="default.aspx" NavBarHome="True">
      <View List="104" BaseViewID="0" WebPartZoneID="Left"/>
      <View List="106" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="2"/>
      <AllUsersWebPart WebPartZoneID="Right" WebPartOrder="1">
         <![CDATA[
            <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" xmlns:iwp="http://schemas.microsoft.com/WebPart/v2/Image">
               <Assembly>Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
               <TypeName>Microsoft.SharePoint.WebPartPages.ImageWebPart</TypeName>
               <FrameType>None</FrameType>
               <Title>Site Image</Title>
               <iwp:ImageLink>/_layouts/images/homepage.gif</iwp:ImageLink>
            </WebPart>
          ]]>
      </AllUsersWebPart>
      <View List="103" BaseViewID="0" WebPartZoneID="Right" WebPartOrder="2"/>
      <NavBarPage Name="Home" ID="1002" Position="Start">  </NavBarPage>
      <NavBarPage Name="Home" ID="0" Position="Start">  </NavBarPage>
   </File>
</Module>