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 / Updating or Creating a...
Power Automate
Unanswered

Updating or Creating a SharePoint calendar item

(0) ShareShare
ReportReport
Posted on by 59

I'm trying to create a flow that activates when a date is added to a column in one SharePoint list and adds that date as an event on a separate SharePoint calendar or modifies an existing calendar event if the date has changed. My problem is that I'm using Get Items to search the calendar for existing events and then a condition to test whether those events have the same name. But because of the Apply to Each loops on each returned item, my actions after the condition occur multiple times.

 

So the first part all works. When someone modifies the date column in the first list, the flow triggers and Gets Items from the calendar, filtered on the correct category for the type of event.

SAHoff_0-1662754276878.png

 

The problem is in the second half. I want the flow to check if the existing calendar items match the title of the list item with the changed date. If there is a matching existing calendar item, I want to update it. If there is not an existing calendar item, I want to create one. What happens is, the flow creates duplicate calendar items, one for each of the Get Items values it has collected, because the entire condition applies to each Get Items value. How do I get it to only modify or create a single calendar entry?

 

SAHoff_1-1662754627320.png

 

And then a second question is, what can I add to the flow to have it delete an existing calendar entry entirely if the date is deleted from the SharePoint list rather than modified?

 

Thanks for your help!

Categories:
I have the same question (0)
  • lbendlin Profile Picture
    8,474 Super User 2025 Season 2 on at

    For the first question - add a variable to the flow, set it to True before processing. In each loop check if the variable is true. Only process the calendar event if that is the case. Then set it to False after the (first) calendar entry has been processed.

  • SAHoff Profile Picture
    59 on at

    Yes, thank you. I'm trying to set this up with a Do Until loop, but I'm not sure how to set the variable to false after just the first calendar entry. It's still completing all of the entries and then setting the variable to false. Is there some setting I'm missing here? I did turn on concurrency control at the Apply to Each level and set Parallelism to 1. Should I not have done that?

  • SAHoff Profile Picture
    59 on at

    Here's the loop, but still getting multiple calendar entries: SAHoff_0-1663688321494.png

     

  • lbendlin Profile Picture
    8,474 Super User 2025 Season 2 on at

    hard to tell without seeing the entire flow . The piece you are showing seems to be ok.

  • SAHoff Profile Picture
    59 on at

    Okay, let's see.

    1. When a list item is created or modified we go ahead and initialize the variable for later and then check to see if the date column was changed:

    SAHoff_0-1663705422333.png

    2. If the date column has been changed, we convert the time zone for that date and then moving to the calendar, get all existing events in a certain category. This is the beginning of the problem, because future actions occur, unnecessarily, for each one of these items that are retrieved.

    SAHoff_1-1663705715139.png

    3. For each calendar item value, we check to see if the Title matches the Title of the trigger list item. If the item already exists as a calendar entry, it gets modified. If not, a new calendar entry is created (except the problem is it's creating duplicate new entries).

    SAHoff_2-1663706002553.png

    And the settings for the Apply to each calendar item look like this:

    SAHoff_3-1663706067589.png

    4. If no calendar item exists, this Do Until loop is supposed to limit the flow to creating a single calendar item and then stopping, but instead we're still getting the same number of new items as there were values from the Get Calendar Items action in #2 above. Can't figure out how to set up the loop to quit after only one value is processed.

    SAHoff_4-1663706159202.png

     

    Really appreciate any insight you may have. I feel like I'm missing something obvious here, but I've been staring at it too long.

     

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard