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);
  • I am trying to set to 'All Events' without success as well..help? – dave Sep 16 '10 at 19:06
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" />
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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