Wednesday, 14 December 2016

Retreiving Recurring Events from a SharePoint Calendar list

I thought it would be useful to post an entry on how to retrieve recurring events from a calendar list. If you ever had to display recurring events, you probably noticed no list items are created for those events in the calendar list.
In order to display those items, I had to do a bit of digging… I noticed that the "Current Events" view from the calendar list would display those recurring events giving the illusion that they were actual unique list items.
Using SharePoint Solution Generator 2008 (as part of the extension for Visual Studio 2008 that can be downloaded here), I extracted the schema.xml that includes all the views including the "Current Events" to see how those events were being retrieved:
The RecurrenceID field identifies a specific instance of a recurring event and its value represents the starting date and time of a specific instance.
In my code, I re-used the query from the view and set as well the SPQuery.ExpandRecurrence property to true:

0 comments:

Post a Comment