SharePoint: Using search to show Recurring Events
Functionality
Accessing SharePoint events using search and displaying details of any Recursive Event.
Solution
Deciding if an Event is Recursive
First we will need to check how SharePoint stores a Recurring Event.
If we go to Events list and fetch details using CAML query builder, we will see one field 'fRecurrence' which indicates if an event is recursive or not.
As in above example, event is ‘Not Recursive’ BUT it’s a long Event which span over 2 days.(Multi Day).
So, easily we can decide if an event is actually Recursive or running for multiple days.
UI Differentiation
In UI we can display this particular event item with different calendar image, to differentiate from other normal events.
Recursive Details
We can provide a flyout (on hover) on Recursive Event to show more details. There is one field ‘RecurrenceData’ in event list which contains XML details of Recurring Event. We can use REST call when hover to fetch this field details (List URL and Item ID from search result)
https://{site_url}/_api/web/lists/getbytitle('Events')/items(1)?$select=RecurrenceData
HTML Decode of the result will give XML Recurrence Data.
<i>
<sup>
<recurrence>
<rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat>
<weekly th="TRUE" weekFrequency="1"/>
</repeat>
<windowEnd>2017-04-26T19:00:00Z</windowEnd>
</rule>
</recurrence>
</sup>
</i>
Using this XML we can generate proper UI element for event details. This link https://help.k2.com/kb001306 explain on XML format.
There is no Crawled Property present for ‘RecurrenceData’ else we could have directly fetch it using search.