SharePointAds TextOnly

Thursday, 15 December 2011

How to create Calendar recurring event from SharePoint Designer 2010 workflow?

Do you want to create new calendar recurring event from SharePoint workflow? If yes, then you are at correct place.
You can easily create simple calendar event (which doesn’t have recurring properties/values), Some days before I was trying to create new recurring event from SPD workflow using “Create Item” action, and found that we can’t create recurring event from SPD workflows because when we’re trying to add new calendar list item from ‘Create Item’ OOB workflow action, at that point we can’t assign the recurring rules values to ‘Recurrence’ column and there is not any available way to pass recurrence rule xml values.
I found an interesting article which creates new calendar event with recurring parameters programatically( But I was looking to create calendar events from SPD workflows and I decided to create workflow custom action to insert new recurring events. If you don’t know how to create custom action for SPD workflows then look at here (, this is very simple and easier solution to create custom custom actions from VS. You just have to make following changes,
  1. Add new class file to the solution for recurring event action (I created as “CreateCalendarRecurrenceEvent.cs”)
  2. Your ‘Element.xml’ file would be as following,  

    <?xml version="1.0" encoding="utf-8"?>

    <Elements xmlns="">


        <Action Name="Create Recurring Event"






                Category="My Custom Workflow Activities">

          <RuleDesigner Sentence="Create New calendar recurring event with title : %1 and rule: %2 (Exception to %3)">

            <FieldBind Id="1" Field="eventTitle" Text="Event Name" DesignerType="TextBox" />

            <FieldBind Id="2"  Field="recurrenceRule" Text="Recurrence Rule" DesignerType="TextBox" />

            <FieldBind Id="3" Field="Except" Text="Exception" DesignerType="ParameterNames" />



            <Parameter Name="__Context"

                       Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions"

                       Direction="In" DesignerType="Hide"/>

            <Parameter Name="eventTitle" Type="System.String, mscorlib" Direction="In"

                       DesignerType="TextBox" Description="Event Name" />

            <Parameter Name="recurrenceRule" Type="System.String, mscorlib" Direction="In"

                       DesignerType="TextBox" Description="Recurrence Rule" />

            <Parameter Name="Except" Type="System.String, mscorlib" Direction="Out"

                       DesignerType="ParameterNames" Description="Exception encountered"/>






  3. In your new class add following method to create new recurring event.
class CreateCalendarRecurrenceEvent


        public Hashtable CalendarRecurrenceEvent(SPUserCodeWorkflowContext context, 
string eventTitle, string recurrenceRule)


            Hashtable results = new Hashtable();

            int iYear = 0, iMonth = 0, iDay = 0;

            results["Except"] = string.Empty;



                using (SPSite site = new SPSite(context.CurrentWebUrl))


                    using (SPWeb web = site.OpenWeb())


                        iYear = DateTime.Now.Year; iMonth = DateTime.Now.Month; iDay = DateTime.Now.Day;

                        DateTime startTime = new DateTime(iYear, iMonth, iDay, 8, 0, 0); //

                        DateTime endTime = startTime.AddHours(6);

                        SPList cal = web.Lists["Calendar"];

                        SPListItem calEvent = cal.Items.Add();

                        calEvent["Title"] = eventTitle;

                        calEvent["RecurrenceData"] = recurrenceRule;

                        calEvent["EventType"] = 1;

                        calEvent["EventDate"] = startTime;

                        calEvent["EndDate"] = endTime;

                        calEvent["UID"] = System.Guid.NewGuid();

                        calEvent["Recurrence"] = 1;




            catch (Exception ex)


                results["Except"] = ex.ToString();


            return results;



(NOTE: I have used default calendar list to create new recurring event, if you want to create recurring event in another calendar list then change 'Calendar' list name.
Build and deploy action and follow the steps given at

In SharePoint Designer workflow, add your custom activity, assign Name and Recurrence Rule pattern as in XML format. You can check more recurrence patterns from Here.
(NOTE :  Rule value must be in single line text, I have used as " <recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><daily dayFrequency='2' /></repeat><windowEnd>2011-12-30T09:00:00Z</windowEnd></rule></recurrence>

I have created SPD custom activity solution on Codeplex, you can download actual project solution from here (

Enjoy custom activity to create new recurring events from SharePoint Designer workflow.


  1. In some cases free SharePoint Workflow Scheduler can save you a lot of time. It allows automatic execution of SharePoint workflows ​by schedule.

  2. Any idea why recurring events created are not shown in the calendar view?

  3. This is very interesting. Wish it wasn't necessary, though. I tried downloading and using the solution from CodePlex. But, after installing it in the site collection, activating it and then activating the feature in the site, the custom activity never showed up in the list of available activities in SPD.

    Is this something I'm going to have to parse out myself?

  4. Hi..
    i am beginner.can you please post basic things related to share i can understand it better.
    thanks in advance

  5. Has anyone attempt to convert this solution for visual studio 2013? I'm interested. Please let me know. Thanks in advance. Mike

  6. Mike, I had developed this VS 2012, you can open the same code solution in VS 2013, it will automatically get convert.

  7. I created a 2013 workflow using web service call to copy recurring event to parent calendar. The items copy, but it doesn't render as recurring until you hit Edit Item, then Save. Has anyone else run into this and is there a solution. If I go the route of creating the custom workflow as in this post, does the same issue occur as I stated?

  8. Using the 2013 SP Designer workflow web service call, a recurring event can be POSTED to a parent calendar, but when the item is created in the parent calendar, it shows as a blue line across the calendar, but when you click on the item it shows recurring as empty. Then if you EDIT the item, you see all of the recurrenceData posted correctly. Only if you save from there, will the data post correctly to the calendar even though it was passed. Any insight on how to remedy this?