web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Copying Office 365 eve...
Power Automate
Unanswered

Copying Office 365 events into SharePoint

(0) ShareShare
ReportReport
Posted on by

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?

Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    on at

    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

     

  • PaulT Profile Picture
    on at

    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

     

  • PaulT Profile Picture
    on at

    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

  • nitrusix Profile Picture
    6 on at

    Yea, I'm seeing the same thing. Definitely a bug in PA that it never spits out "deleted" events for removed occurrences of a repeating event. The only way I can think of to do it is use the Master Series ID to blow away all the instances of the original event that were created and then add the remaining ones back. I haven't finished architecting this yet, but I think I have a path forward.

  • djhgirl3 Profile Picture
    2 on at

    Hello, if you are still available, i'd like some help setting this up for my customer.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard