Skip to main content

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.

 

 

205061_pastedImage_12.png

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

205062_pastedImage_1.png

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

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

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.

205066_pastedImage_3.png set a helper variable that will flag whether we identified overlapped events or not
205071_pastedImage_2.png

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

 

so first set of conditions.

205072_pastedImage_3.png second set of conditions
205073_pastedImage_4.png third set of conditions
205074_pastedImage_5.png

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

205076_pastedImage_1.png

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

205077_pastedImage_2.png

 

workflow output

 

205078_pastedImage_3.png

 

 

find the workflow attached.

tested on NW2013 on-prem

 

 

 

Hope it helps to someone!

Be the first to reply!

Reply