0

I'm trying to create a custom calendar in a feature, but something is not working right. I am able to create events, but if I try to create a recurring event, I get an error. I'm using Sharepoint 2013 and trying to deploy my feature through Visual Studio 2012.

Steps to reproduce In Visual Studio

  1. Add New Item
  2. List
  3. Create a customize list template and list instance of it: a. Select "Calendar" in drop down.
  4. Deploy

A few odd behaviors I've noticed.

  1. Instead of the normal Calendar ribbon bar with "Events", and "Calendar", I get one with "Items", "List", and "Calendar".
  2. When I check the "Recurrence" check box, a Calendar created through the Sharepoint UI will auto fill the Start Date. In my Calendar, this field is blank by default. I am able to fill it in.

Here is the error message.

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: Value does not fall within the expected range. at Microsoft.SharePoint.WebControls.RecurrenceField.SetRecurrenceFields() at Microsoft.SharePoint.WebControls.RecurrenceField.CompleteItemLoad() at Microsoft.SharePoint.WebControls.SaveButton.ActionBeforeSaveItem(SPContext itemContext) at Microsoft.SharePoint.WebControls.SaveButton.SaveItem(SPContext itemContext, Boolean uploadMode, String checkInComment) at Microsoft.SharePoint.WebControls.SaveButton.OnBubbleEvent(Object source, EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.FORM_ASPX_405394071.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9251a794\cea24f96\App_Web_form.aspx_405394071.bveoxq2l.0.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

  • I'm selecting "Calendar" in Visual Studio (instead of "Default (Custom List)") when I create my list. Is there something else you are asking? – cadrell0 Jul 23 '13 at 16:47
4

Just in case someone else comes across this question -> Here is my solution that works in Visual Studio with a Custom List Definition based on Calendar.

You need to edit the following:

Elements.xml for the List Definition -> Change the "Type" attribute to 106. This will create a list based on the SPListTemplateTypeId 106 (Calendar) http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splisttemplatetype.aspx

Elements.xml for the List Instance -> Change the TemplateType attribute to 106.

Schema.xml for the List Definition -> Change the DefaultView="TRUE" to DefaultView="FALSE" for the BaseViewID="1" and then change DefaultView="FALSE" to DefaultView="TRUE" for BaseViewID="2". This will enable the proper View/Ribbon bar when the list is first instantiated.

Jason

  • I've just had the exact same problem, and this is precisely what I needed! Excellent! I'd give you multiple +1s if I could. :) – Shaamaan May 6 '15 at 10:48
  • Just confirming it worked for me too. Imho, this should be the actual answer. – SPArchaeologist Aug 26 '15 at 12:18
  • It's works for me – Akshay Dattatray Nangare Apr 26 '17 at 10:56
0

Instead of creating the calendar through a feature element, I decided to give it a go programmatically. I deleted the list from Visual Studio, and I am using the overload of SPListCollection.Add that uses SPListTemplateType in my FeatureActivated method. By passing in SPListTemplateType.Events, the calendar is created and functions properly.

I am also able to add custom content types and fields to the calendar in my FeatureActivated method.

I'd still like to get to the root of the problem with using the feature element, if anyone has any ideas.

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.