cancel
Showing results for 
Search instead for 
Did you mean: 

SharePoint Get Items needs CAML support and support for additional data fields to support Sharepoint Calendars

When using Get Items for a SharePoint list which is an Events Calendar, it only works for single-instance events. Any event which is recurring is missing crucial recurrence details.

Status: New
Comments
Level: Powered On
Level: Powered On

I found a (really not great) workaround, which allowed me to make a HTTP call to SharePoint, provide a query, get events back, including recurrenceData, and then add additional logic to parse out the results.

 

You need to build a REST call to SharePoint.

 

Sample uri:

_api/web/lists/GetByTitle('foo')/GetItems?$select=RecurrenceData,Title,EventDate,EndDate

 

Sample body:

{ "query" : {"__metadata": { "type": "SP.CamlQuery" }, "ViewXml":"<View><Query><Where><DateRangesOverlap><FieldRef Name='EventDate' /><FieldRef Name='EndDate' /><FieldRef Name='RecurrenceID' /><Value Type='DateTime'><Month /></Value></DateRangesOverlap></Where><OrderBy><FieldRef Name='EventDate' Ascending='True' /></OrderBy></Query><ViewFields><FieldRef Name='Title' /><FieldRef Name='EventDate' /><FieldRef Name='EndDate' /><FieldRef Name='fRecurrence' /><FieldRef Name='RecurrenceData' /><FieldRef Name='Location' /></ViewFields><QueryOptions><CalendarDate>@{formatDateTime(utcNow(), 'MM/dd/yyyy HH:mm')}</CalendarDate<ExpandRecurrence>TRUE</ExpandRecurrence><ViewAttributesScope='RecursiveAll' /></QueryOptions></View>"}}

 

Then Parse JSON. Sample schema:

{
"type": "object",
"properties": {
"d": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Title": {
"type": [
"string",
"null"
]
},
"EventDate": {
"type": [
"string",
"null"
]
},
"EndDate": {
"type": [
"string",
"null"
]
},
"RecurrenceData": {
"type": [
"string",
"null"
]
}
}
}
}
}
}
}
}
 
Then do some select actions and filter actions to clean up your results.
 
Note: When filtering for EventDate and EndDate, use the ticks() expression like:
ticks(item()['EventDate'] 'is less than or equal to' ticks(utcNow())
 
The parsing/sorting for my POC become so complex I couldn't manage it in Flow any longer, so I make a HTTP call out to a Function App (PowerShell core) to do the lifting for me.