cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PaulT
Level: Powered On

Copying Office 365 events into SharePoint

I have been working on a flow to copy events from the calendar of my organization's president into a SharePoint list and I have gotten most of it to work. I am including the ID of the event and using "Get Items" from SharePoint to deal with deletions and updates. When I add/change/delete a single item everything works perfectly.

The problem comes when dealing with recurring items. It looks like that when I delete a single item in a recurring event that Office 365 removes the entire series and creates all of the remaining entries again. This causes duplicate entries of all of the remaining occurences. It doesn't seem to ever trigger the deletion step in a flow so nothing gets removed.

 

Any ideas how to deal with recurring items when working in a flow?

3 REPLIES 3
Community Support Team
Community Support Team

Re: Copying Office 365 events into SharePoint

Hi @PaulT,

 

Could you please share a screenshot of your flow's configuration?

 

I have made a test on my side and don't have the issue that you mentioned. My flow's configuration as below:

  • Add a "When an event is added, updated or deleted" trigger, specify Calendar id.
  • Add a "Get items" action, specify Site Address and List Name set to your event list.
  • Add a "Filter array" action, From set to output of "Get items" action. Click "Edit in advanced mode", type the following formula:

 

@contains(item()?['Title'], triggerBody()?['Id'])

 

  • Add a Condition, click "Edit in advanced mode", type the following formula:

 

@empty(body('Filter_array'))

 

 

  • Within "If/yes" branch of Condition, add a "Create item" action, specify Site Address and List Name set to your event list.
  • Within "If/no" branch of Condition, add a Condition 2 action, left input box set to Action Type dynamic content of the trigger, right input box set to updated, within middle drop down, choose is equal to.

         Within "If/yes" branch of Condition 2, add a "Apply to each" action, input parameter set to output of "Filter array" action. Within "Apply to each" action, add a "Update item" action, Id field set to following formula:

 

item()?['ID']

 

        Within "If/no" branch of Condition 2, add a "Apply to each 2", input parameter set to output of "Filter array" action. Within "Apply to each" action, add a "Delete item" action, Id field set to following formula:

 

item()?['ID']

Note: When I add a Recurrence event in my Outlook calendar, the flow would not create a recurrence event in my SharePoint calendar. It would create several separated events in my SharePoint calendar.

 

 

Image reference:7.JPG

 

8.JPG

 

9.JPG

 

 

The flow works successfully as below:10.JPG 

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PaulT
Level: Powered On

Re: Copying Office 365 events into SharePoint

First @v-xida-msft thank you for taking time out to help.

 

I can't figure out how to attach screenshots to a post (sorry) but I will describe what I have done. I am also wondering if I made this in an inefficient manner as I am just starting to learn some of the things I can do with Flow. In fact, looking at your flow I may have already found some things to change but I am going to post my current set up.

I set up a SharePoint list with Title, Start Time, End Time, Category, and Event ID. Category will be changed by the user in SharePoint later until MS updates the "When an event is added..." connector is updated to include category. Event ID will be set to the ID of the calendar even

 

  • Add a "When an event is added, updated or deleted" trigger, specify Calendar id.
  • Add a "Switch Case" based on the Action Type of the event.
    • Case equals "added"
      • Create a new item in SharePoint setting the appropriate fields. Event ID is set to the ID of the Office 365 event.
    • Case equals "deleted"
      • "Get Items" from the SharePoint list using a filter query "EventID eq 'ID'"
      • Set up a Condition @equals(length(body('Get_items')?['value']), 0)
      • If/yes branch does nothing
      • if/no branch - "Apply to each 'value' from the Get Items delete the current item
    • Case default - the only option left is an updated item
      • "Get Items" from the SharePoint list using a filter query "EventID eq 'ID'"
      • Set up a Condition @equals(length(body('Get_items')?['value']), 0)
      • If/yes branch does the same steps as the "added" step above. This is to handle cases where an item that existed before the flow was run is modified. It would not have an entry in SharePoint yet
      • If/no branch - "Apply to each 'value' from the Get Items an Update Item step on the current item overwriting the current item from the "Get Items"

As I said in the initial post this all works fine for a single item. For a new recurring item it works also. The problem is when trying to delete or update a single instance of a recurring item. Then it just adds an additional entry for all of the remaing occurences.

If I can figure out how to post screenshots I will do so. In the meantime I am trying to use the code from @v-xida-msft to see if I can work this out.

 

Paul

 

Highlighted
PaulT
Level: Powered On

Re: Copying Office 365 events into SharePoint

So I have been trying to do some more poking around. I created a new flow which simply fires off when a new event is added, updated or deleted. It then sends me an e-mail with the "Action Type" in the body.

What I have discovered is that when I delete single item of a recurrence none of the e-mails come back with an action type of "deleted" rather I will get a bunch of "added" e-mails.

This means that deleting a an instance of recurring item removes the entire recurrence and rebuilds it with the remaining items. Since these all fire off individual instances of the flow I don't see any way to deal with this,

 

Paul

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 517 members 4,548 guests
Please welcome our newest community members: