Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

1 Answer 1

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" />
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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