Friday, November 9, 2012

HOW TO ADD A CALENDAR LIST VIEW WEB PART TO ONET.XML

Hi All,

My requirement was to add a calendar in a provisioned page so I found there is a way to set web part properties inside a CDATA section of the view. The Views are generated from the Microsoft.SharePoint.WebPartPages.ListViewWebPart.

I hope this code will help your requirements as well.


<View List="Lists/PluginCalendar" BaseViewID="2" Type="CALENDAR"
       Scope="Recursive" RecurrenceRowset="TRUE" WebPartZoneID="TopWebZone"
       WebPartOrder="0">
       <![CDATA[
         <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
             <Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,
                       PublicKeyToken=71e9bce111e9429c</Assembly>
             <TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart
                       </TypeName>
             <Title>Calendar of Events</Title>
             <FrameType>None</FrameType>
         </WebPart>
       ]]>
 </View>

1 comment: