SharePoint 2010 – Display the calendar webpart in a calendar view when creating a site definition

Recently, I came across an issue with custom site definition which had to display on the default page the calendar webpart as a calendar view (like the one displayed in the default Team Site).

To create this custom site definition, I reused some code available in the default Team Site site definition ; especially the default.aspx page code (why redo something already done Smile?)

So, everything was working except for the calendar webpart which was always displayed in a list instead of displayed as a calendar

What I wanted What I had
image image

The view settings for this webpart was reused from the Team Site site definition: <View List="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;" BaseViewID="0" MobileView="TRUE" RecurrenceRowset="TRUE" WebPartZoneID="Left" WebPartOrder="2" />

As this didn’t worked, I looked for solution and found there is a View settings (in this case, this was BaseViewID=4 – the value 4 is for the calendar view), but this didn’t work neither.

Finally, the solution was little bit more tricky:

<View BaseViewID="2" List="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;" WebPartZoneID="Left" DefaultView="TRUE" Type="CALENDAR" WebPartOrder="2" >
                   <WebPart xmlns="">
                   <Assembly>Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>

Leave a Comment

Your email address will not be published. Required fields are marked *