emha

Identify overlapping events in sharepoint calendar

Blog Post created by emha Moderator on Jun 28, 2017

Based on the question Is it possible to look for conflicting schedule in calendar app? risen by Rogelio Tan I've built a small example workflow how to identify overlapping events in sharepoint's calendar list.

 

Note: workflow works just on simple not recurring calendar events!

 

 

so this is how the workflow looks like and works.

 

 

first of all we need to identify set of events that we want to compare.

so we query a calendar list with some reasonable filtering condition. for this demonstration I haven't used any filters.

 

we need to query for event's start and end times, plus some event identifier, eg. ID or Title.

we save values for each queried fields to separate collection variable

to identify overlapping events, we need to compare them each to other.

so we will need two nested loops over collections returned from query above.

 

so we configure first for each loop over ID collection, and save current event's ID value and current index to a scalar variables

within  the loop, using index variable we do so as well for current event's Start and End times.
then we will setup second for each loop over the same collection, save values for second event to compare.

just like for first event we pick Start and End times for second event from source collection.

 

note the run-if condition at the beginning of loop, which prevents to compare each pair of events twice.

set a helper variable that will flag whether we identified overlapped events or not

and proceed to comparison whether we have overlapping events or not.

 

so first set of conditions.

second set of conditions
third set of conditions

now we are sure whether events overlap or not.

 

if they do, we will save them to another collection variables.

we will maintain 6 of them - 3 variables for each of two events.

the same index position across all the 6 collections will identify data of two overlapping events

AND WE ARE DONE!

 

we have data of overlapping calendar events in collections and we can process them further as needed.

 

for this demo purposes we'll just write them to history log.

 

 

this is how output might look like:

 

events in calendar

 

workflow output

 

 

 

find the workflow attached.

tested on NW2013 on-prem

 

 

 

Hope it helps to someone!

Outcomes