Friday, March 25, 2011

To provision a file in Pages document library

Below is the feature file that is used to upload a file in to Pages document library on feature activation

Feature.xml

<?xml version="1.0" encoding="utf-8"?>
<Feature  Id="21a53317-2fd7-4f21-b5c4-efc018b88154"
          Title="Add Site Users List Template "
          Description="Upload the 'All Site Users' list template to site collection"
          Version="12.0.0.0"
          Hidden="FALSE"
          Scope="Site"
    ActivateOnDefault="FALSE"
          DefaultResourceFile="core"
          ReceiverAssembly="xxxx.yyy.ListAllUsers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5"
          ReceiverClass="xxxx.yyy.ListAllUsers.AddGetUsersList"       
          xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="elements.xml"/>
   <ElementFile Location="webpartpage.aspx"/>
  </ElementManifests>
</Feature>

Elements.xml

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="Pages" Path="" Url="Pages">
<File Name="webpartpage.aspx" Url="webpartpage.aspx" IgnoreIfAlreadyExists="FALSE"/>
</Module>
</Elements>

Once the feature is activated the file is uploaded to the document library, however I cannot view the file in default view but able to view in the Explorer view, currently working on that

No comments:

Post a Comment