1

I am trying to add a calendar web part to the default.aspx page within a feature. The calendar gets placed on the form but I would like the default view to be the summary view. I have read that if you set the ViewGuid to string.Empty it will set the view to the summary view but this is not working.

Ideas?

// Calendar 
ListViewWebPart calendarWP = new ListViewWebPart(); 
SPList calendarList = site.Lists["Calendar"]; 
calendarWP.ListName = calendarList.ID.ToString("B").ToUpper(); 
calendarWP.ViewGuid = string.Empty; 
oWPManager.AddWebPart(calendarWP, "Left", 3);
1
  • I am trying to set to 'All Events' without success as well..help?
    – dave
    Sep 16, 2010 at 19:06

1 Answer 1

2

Try the approach using feature XML described by Yaroslav Pentsarskyy.

<View List="Lists/Calendar"
BaseViewID="2"
Type="CALENDAR"
Scope="Recursive"
RecurrenceRowset="TRUE"
WebPartZoneID="BottomLeft"
WebPartOrder="0" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.