Hi @TomTT ,
I'm assuming that you're trying to get all future events from O365 group calendar, then create those events into the SharePoint Events list.
Now your issue is that you don't want to add the same event twice into the calendar?
Well, there are multiple scenarios you need to consider before jumping in.
- A new event has been created in the group calendar - You need to create a new item in SP List
- A event already created might have been edited and moved to a different date - You need to update the exact existing event in the SP List
- An event might have been cancelled - Based on your preference, you can either delete the event from list or update the status as cancelled
Here's how I'd do it.
- For the first time, I won't write any conditions and just add all existing events from group calendar into the SP list - I'll add a column called EventID to identify events from group calendar
- Once the initial sync is done, I'll add filter clauses as below
- StartDateTime >= today and (Modified > (Now - 1 day) || Created > (Now - 1 day)) - This way I'm only getting the events whose start date is greater than or equal to today and are modified or created after the last flow run
- I'll loop through all the events I get from the "get events" http action and add below actions in loop,
- Condition to check if the event exists in list by checking for EventID, using "get Items" action filter clause
- Update the event - new date time or cancellation status
- Else
- Create event with event ID
This way, you'll be covering all scenarios of Calendar sync to SP.
Coming to the your actual issue, I noticed that you're passing the whole object to the SP create Item action date field. Instead you only need to pass the dateTime string. Replace your start and end values with this expressions
Start: body('Parse_JSON')?['properties']?['value']?['items']?['properties']?['start']?['dateTime']
End: body('Parse_JSON')?['properties']?['value']?['items']?['properties']?['end']?['dateTime']
Kind Regards,
Shaik Sha
________________________________________________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.