SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


// 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 – dave Sep 16 '10 at 19:06

Try the approach using feature XML described by Yaroslav Pentsarskyy.

<View List="Lists/Calendar"
WebPartOrder="0" />
share|improve this answer

Your Answer


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.