Reading the recurring events in a SharePoint calendar using Nintex – Part 1

Recurrence in SharePoint’s calendar list is a wonderful feature that allows the creation of events that may be recurring in nature. It could be daily or weekly or monthly or yearly recurrence.

Once a recurring event is created, it is smart enough to update dates in the calendar accordingly.

Amazing! huh!!

Now I am not writing this post to tell you the benefits of recurrence in a calendar list. I have my own reasons.

My requirement was to send reminder emails to the users 4 days in advance from the date the event is to happen. Also, an email should go on the same date of event.

I was under the impression that it should be pretty simple. But my conviction was lost when I saw that the start time is the date of 1st occurrence and end time is the date of last occurrence. Which means the dates that come in between are not logged anywhere for me to do the comparison and send out emails. Although the calendar view of the list shows all occurrences properly.

So the foremost concern was to get the recurring information of the event.

A lot of research led me to my findings which I am sharing here, so that you don’t have to invest your time in it.

The recurrence information of an event can be fetched using the Query List action. It returns an XML which contains below information for recurrence

  • Kind of recurrence (daily, weekly, monthly, yearly)
  • Varying rules around the recurrence (on a specific date, or a specific day of the week, etc)
  • End of recurrence (never, after x occurrences, on a specific date)

Recurrence XML outcomes

Daily

Recurring every day, with no end date:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><daily dayFrequency="1" /></repeat>
<repeatForever>FALSE</repeatForever>
</rule></recurrence>

Recurring every weekday, end after 10 occurrences:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><daily weekday="TRUE" /></repeat>
<repeatInstances>10</repeatInstances>
</rule></recurrence>

Recurring every 3 days, specific end date:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><daily dayFrequency="3" /></repeat>
<windowEnd>2012-04-26T20:00:00Z</windowEnd>
</rule></recurrence>

Weekly

Recurring every 1 week on a specific day, end after 10 occurrences:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><weekly tu="TRUE" weekFrequency="1" /></repeat>
<repeatInstances>10</repeatInstances>
</rule></recurrence>

Recurring every 1 week on a specific day, specific end date:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><weekly tu="TRUE" weekFrequency="1" /></repeat>
<windowEnd>2012-04-26T20:00:00Z</windowEnd>
</rule></recurrence>

Recurring every 2 weeks on a specific day, no end date:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><weekly tu="TRUE" weekFrequency="2" /></repeat>
<repeatForever>FALSE</repeatForever>
</rule></recurrence>

Monthly

Recurring on a specific date of the month, no end date:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><monthly monthFrequency="1" day="26" /></repeat>
<repeatForever>FALSE</repeatForever>
</rule></recurrence>

Recurring on a specific day every 1 month, end after 10 occurrences:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><monthlyByDay tu="TRUE" weekdayOfMonth="first" monthFrequency="1" /></repeat>
<repeatInstances>10</repeatInstances>
</rule></recurrence>

Recurring on a specific date every 3 months, end after 10 occurrences:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><monthly monthFrequency="3" day="26" /></repeat>
<repeatInstances>10</repeatInstances>
</rule></recurrence>

Recurring on a specific day every 3 months, end on a specific date:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><monthlyByDay tu="TRUE" weekdayOfMonth="first" monthFrequency="3" /></repeat>
<windowEnd>2012-04-26T20:00:00Z</windowEnd>
</rule></recurrence>

Yearly

Recurring annually on a specific date, no end date:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><yearly yearFrequency="1" month="4" day="26" /></repeat>
<repeatForever>FALSE</repeatForever>
</rule></recurrence>

Recurring annually on a specific date, ends on a specific date:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><yearly yearFrequency="1" month="4" day="26" /></repeat>
<windowEnd>2012-04-26T20:00:00Z</windowEnd>
</rule></recurrence>

Recurring annually on a specific day, ends after 10 occurrences:

<recurrence><rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><yearlyByDay yearFrequency="1" tu="TRUE" weekdayOfMonth="first" month="4" /></repeat>
<repeatInstances>10</repeatInstances>
</rule></recurrence>

Now that the recurrence information is there in XML, it can be broken using the Query XML action. This will give the detailed information such as the type of recurrence, the rule, the end of recurrence. Using all this information and Nintex workflows, the forthcoming date for an event can be calculated.

Same is demonstrated in the 2nd part of this post Read the recurring event and calculate the date of next occurrence using Nintex – Part 2

 

Advertisements

One thought on “Reading the recurring events in a SharePoint calendar using Nintex – Part 1

  1. Pingback: Read the recurring event and calculate the date of next occurrence using Nintex – Part 2 | My Learnings

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s