RecurrenceData: "<recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><daily dayFrequency="1" /></repeat><windowEnd>2017-02-21T01:00:00Z</windowEnd></rule></recurrence>"
I used something similar to the above schedule to start a daily timecard entry event in a SharePoint Calendar. The scenario is basically to track a daily task to submit a timecard, but there are a lot of exceptions. Take for example an employee named Karen. She has alternating Monday-Tuesday and then Thursday-Friday off and works weekends. Bob happens to be putting in a bit of overtime for the next week before going on vacation. Again, exceptions occur often, so we see variable schedules for Karen and Bob:
If we were to process the RecurrenceData XML rule above in order to build logic which triggers an e-mail or reminder to Bob/Karen to enter their timecard, we’d end up triggering the activity on dates when they were off (days like the exceptions above, holidays, sick days, and so on). Fortunately, the exceptions are also stored as list items in the SharePoint Calendar list item collection – they’re just not shown on the calendar view. In the above Calendar, we’ll get back 6 list items: the recurring event schedule for Karen, the recurring event schedule for Bob, and then the four exceptions to Karen’s schedule.
The first thing to do is to group the exceptions with their parent event. As noted, this is very intuitive:
- Group the list items on the
UIDproperty or match them by the
- Then, sort the items in ascending order by the
- There are even more creative ways to match and order and identify the exceptions you want to work with. See below for examples of use fields…SharePoint even prepends “Deleted: ” to the
Titleproperty of the exception
Finally, you can now use the
RecurrenceID property to identify the exact date of the exception to the schedule and prevent the e-mail or reminder from going out.