cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sleky
Frequent Visitor

SharePoint Calendar and Events

I had initiall posted this in the wrong forum; trying again here!  lol

 

I am trying to create a flow that will:

 

Create a new event unless one exists, then it will update the existing event.

 

I'm [    ] that close to getting this to work!  Just can't figure out the if/then statement.  

 

I can get the flow to email me all the pertinent information, so the trigger is perfect.  I am triggering off of "When an event is created or modified" and it is a List name = "group calendar".

 

I can get the flow to create the event just fine as well.

 

However, what I'm having issues with is if the event exists, it updates it instead of creating a new one.  I just tried one last time to get it to work, and it went thru ALL my events, checked the condition (if the ID matches) and executes on that one event, which will create the event because the ID's don't match.  But then it went onto the next irrelevent event and repeated.  Thankfully Outlook lists events and easy deletion (phew).

 

I can provide SS's or such.  TIA

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ Slekys,

Do you want the flow to :

  1. When an event is new created in your group calendar list, create a new event in Office365 outlook.
  2. When an event is updated in your group calendar list, update the event in Office365 outlook.

 

Because the outlook event’s id is generated by System automatically, so you need to add a column in your calendar list and save the outlook event’s id in this column.

When an event is created in your outlook, the outlook event’s id should be saved in the column in your calendar list.

Your calendar list should have no event before you create the flow so that all new created event in your calendar list would have a value in outlook event id field.

To add a column in your calendar list ,please follow steps below:

  1. Sign in your sharepoint ,find your calendar list
  2. Click the gear in the calendar list web’s top right ,select Site settings

 1.png

     3.Click the Site columns in the Site settings web.

 

 2.jpg

     4.Click Create in the Site columns web.

3.png

     5.Add a column name “outlook event id” in the Create columns web. the column set to Single line of text type. Make sure to save the column.

 4.jpg

 

 

 

You could create a flow as steps below:

  1. Add a trigger “When an item is created or modified”, fill in your Site Address and calendar list Name.
  2. Add action “Get item”, fill in your Site Address and calendar list Name, choose the ID dynamic content of “When an item is created or modified” in Id field.
  3. Add action “Get events(V1)”, choose your Calendar in Calendar id field.
  4. Add action “Initialize variable”, the Name field set to Integer,the Type field choose Integer, the Value field set to “0”
  5. Add an apply to each, choose the value dynamic content of “Get events(V1)” action in the input field.
  6. Inside the apply to each, add a Condition, the first value set to the outlook event id dynamic content of “Get item”, the second value set to the Id dynamic content of “Get events(V1)”, the condition in the middle select is equal to.
  7. Inside the If yes, add action “Update event(V1)”, choose your Calendar in Calendar id field, choose Id dynamic content of “Get events(V1)” in Id field, choose the End Time, the Start Time dynamic content of “When an item is created or modified”,choose Title dynamic content of “When an item is created or modified” in Subject field.
  8. Add a “Increment variable” under the “Update event(V1)”. Name field choose Interger. Every time the Increment variable action runthe Interger would increase 1.
  9. Outside the apply to each, add a Condition2, the first value set to the Integer dynamic content of Variables, the second value set to “0”, the condition in the middle select is equal to. The Integer’s value would always be “0” if the “Update event(V1)” haven’t run. that stand for “No update event” and mean we need to “Create event” next.
  10. Inside the if yes, add action “Create event(V1)”, choose your Calendar in Calendar id field, choose the End Time, the Start Time dynamic content of “When an item is created or modified”,choose Title dynamic content of “When an item is created or modified” in Subject field.
  11. Add action “Update item” under the “Create event(V1)”, fill in your Site Address and calendar list Name, choose the ID dynamic content of “When an item is created or modified” in Id field, choose the Title dynamic content of “When an item is created or modified” in Title field, choose the Title dynamic content of “When an item is created or modified” in Title field, choose the End Time, the Start Time dynamic content of “When an item is created or modified”, and choose the Id dynamic content of “Create event(V1)”.

 

Image reference:

 5.png6.png7.png

 

 

 

 

When an item is created, the flow run successfully as below:

 

8.png

When an item is updated, the flow run successfully as below:

 9.png

 

 


Regards,
Alice Zhang

View solution in original post

22 REPLIES 22
Sleky
Frequent Visitor

So - Here is what I got.  When it runs, because of an update/creation on the sharepoint calendar.  It will basically creates only one new item at a time and will delete any previous entries into my O365 calendar.

 

That is really puzzeling!

 

Screen Shot 2018-01-24 at 8.17.56 PM.png

Anonymous
Not applicable

Have you tried adding a condition that checks the "ID" of the new event and "ID" in the get events step?

 

If you want your calendar to check if the event already exists, then I think you need a condition that actually looks up event IDs. I have not tested this - I just wanted to share this quick idea!

The second action step is to gather up my calendar events.  I'm wondering if I need to use the "filter" on that step to focus on only the ID we are focusing on.  I tried to but in dynamic content; but it complained about that filter.  So I had to strip it out.

 

I have tried using a conditional action step; but it would change the flow as soon as I left the A = B? condition and change it to an "apply to all items" sorta scenario.  Very odd

 

 

 

 

Screen Shot 2018-01-26 at 7.21.04 AM.png

Screen Shot 2018-01-26 at 7.30.22 AM.png

Anonymous
Not applicable

I think you need the "apply to each", because it needs to check all calendar events to see if there is a matching event. 

 

 

Attached is a screenshot of what I was thinking in terms of the flow steps. I have not fully tested this flow - I wanted to at least quickly share a potential structure. 

 

 

Screen Shot 2018-01-26 at 9.32.17 AM.png

 

Have you tried separating this process into two flows? One flow would start with "when an item is created" trigger and the other would start with "when an item is modified". 

Hi @ Slekys,

Do you want the flow to :

  1. When an event is new created in your group calendar list, create a new event in Office365 outlook.
  2. When an event is updated in your group calendar list, update the event in Office365 outlook.

 

Because the outlook event’s id is generated by System automatically, so you need to add a column in your calendar list and save the outlook event’s id in this column.

When an event is created in your outlook, the outlook event’s id should be saved in the column in your calendar list.

Your calendar list should have no event before you create the flow so that all new created event in your calendar list would have a value in outlook event id field.

To add a column in your calendar list ,please follow steps below:

  1. Sign in your sharepoint ,find your calendar list
  2. Click the gear in the calendar list web’s top right ,select Site settings

 1.png

     3.Click the Site columns in the Site settings web.

 

 2.jpg

     4.Click Create in the Site columns web.

3.png

     5.Add a column name “outlook event id” in the Create columns web. the column set to Single line of text type. Make sure to save the column.

 4.jpg

 

 

 

You could create a flow as steps below:

  1. Add a trigger “When an item is created or modified”, fill in your Site Address and calendar list Name.
  2. Add action “Get item”, fill in your Site Address and calendar list Name, choose the ID dynamic content of “When an item is created or modified” in Id field.
  3. Add action “Get events(V1)”, choose your Calendar in Calendar id field.
  4. Add action “Initialize variable”, the Name field set to Integer,the Type field choose Integer, the Value field set to “0”
  5. Add an apply to each, choose the value dynamic content of “Get events(V1)” action in the input field.
  6. Inside the apply to each, add a Condition, the first value set to the outlook event id dynamic content of “Get item”, the second value set to the Id dynamic content of “Get events(V1)”, the condition in the middle select is equal to.
  7. Inside the If yes, add action “Update event(V1)”, choose your Calendar in Calendar id field, choose Id dynamic content of “Get events(V1)” in Id field, choose the End Time, the Start Time dynamic content of “When an item is created or modified”,choose Title dynamic content of “When an item is created or modified” in Subject field.
  8. Add a “Increment variable” under the “Update event(V1)”. Name field choose Interger. Every time the Increment variable action runthe Interger would increase 1.
  9. Outside the apply to each, add a Condition2, the first value set to the Integer dynamic content of Variables, the second value set to “0”, the condition in the middle select is equal to. The Integer’s value would always be “0” if the “Update event(V1)” haven’t run. that stand for “No update event” and mean we need to “Create event” next.
  10. Inside the if yes, add action “Create event(V1)”, choose your Calendar in Calendar id field, choose the End Time, the Start Time dynamic content of “When an item is created or modified”,choose Title dynamic content of “When an item is created or modified” in Subject field.
  11. Add action “Update item” under the “Create event(V1)”, fill in your Site Address and calendar list Name, choose the ID dynamic content of “When an item is created or modified” in Id field, choose the Title dynamic content of “When an item is created or modified” in Title field, choose the Title dynamic content of “When an item is created or modified” in Title field, choose the End Time, the Start Time dynamic content of “When an item is created or modified”, and choose the Id dynamic content of “Create event(V1)”.

 

Image reference:

 5.png6.png7.png

 

 

 

 

When an item is created, the flow run successfully as below:

 

8.png

When an item is updated, the flow run successfully as below:

 9.png

 

 


Regards,
Alice Zhang

You are a mad scientist!

 

So close, when creating the event in my calendar, it makes, like 8 copies.  I noticed, that when creating the event on the sharepoint calendar, the Outlook EventID isn't being filled with anything.  Is there a way to make that auto-increment on sharepoint when the event is created?

Anonymous
Not applicable

@v-yuazh-msft What a great solution!

 

I implemented your recommendation and the flow successfully created an Outlook event based on the SharePoint calendar item.

 

However, when the SharePoint calendar item was updated at a later time, the flow failed to update the Outlook calendar item with the new SharePoint details. '

 

I receive the following error message for updating the outlook event: 

 

  "message""Your request can't be completed. The start and end times for an all-day event need to be set to midnight.\r\nclientRequestId: 7f137333-d881-415a-953b-bf7e357a7aa1",

 

 

I have the "Update event" settings exactly like the "create event" settings and there is no problem with creating an event. 

I missed the part where it updates the sharepoint item and adds the ID to the sharepoint item.  I've added that - however, it is still creating an separate event for EACH item in my calendar.  Very odd.  Also - for whatever reason, when I update the sharepoint calendar, it will run 2 or 3 times EACH update.  Argh....

 

Also - this just dawned on me.  What'll happen if someone removes the event on sharepoint calendar.  There is an update, but it's gone...  Hmmmmmm

Anonymous
Not applicable

If the event is removed from the SharePoint calendar, I want the flow to run and update (i.e. delete) the Outlook event accordingly. 

 

@v-yuazh-msft - Can this be done? I tested a deletion and the flow did not run. Do you have any other recommendations for addressing the issues we are experiencing?

Here's what I've got.  Runs fine; -ish.  It created 10 events.  <sigh>  Here is my flow as it stands:

Screen Shot 2018-02-06 at 11.16.23 AM.png

Screen Shot 2018-02-06 at 11.16.44 AM.png
Screen Shot 2018-02-06 at 11.17.13 AM.png
Screen Shot 2018-02-06 at 11.17.50 AM.png

Screen Shot 2018-02-06 at 11.18.19 AM.png

 

Here are the results...

Screen Shot 2018-02-06 at 11.19.45 AM.png

 

Here is my calendar now....

Screen Shot 2018-02-06 at 11.19.56 AM.png

 

As far as I can tell, I've got it set-up just how you described.  Yet it is creating a ton of events and not actually working right.  Any thoughts as to why it won't work for me, lol?  I know, user error....  hahahaha  TIA!!

Anonymous
Not applicable

@Sleky It looks like you have both conditions in the "Apply to each". 

 

Place the "Integer equal to 0" condition outside of the "Apply to each" and run another test to see if the flow works as expected. I have my flow set up this way and it creates the events correctly. 

So this is wrong?  The "Condition 2" happens outside of the "Apply to each"?

 

Screen Shot 2018-02-06 at 11.46.08 AM.png

Anonymous
Not applicable

@Sleky This is how mine looks:

 

Screen Shot 2018-02-06 at 11.49.19 AM.png

AWESOMESAUCE!!!!!  So yea, about those event deletions...  hahahahaha!!!  You two rock, thank you both so much!!

 

Screen Shot 2018-02-06 at 12.06.37 PM.png

Sleky
Frequent Visitor

So - sounds like we have a couple issues left...

 

1.  Event is deleted on sharepoint - retains on calendar

2.  All day events aren't being registered on calendar

 

Lastly - I saw there was some error correcting?  Is that needed?

Sleky
Frequent Visitor

Well, seems like something Microsoft is needing to immplement.  Grrrr....  

 

https://powerusers.microsoft.com/t5/Flow-Ideas/SharePoint-Trigger-on-Item-Deleting/idi-p/5171

Hi All,
 I have setup as per instructions and mine still appears to be making multiple entries, and it keeps going until I stop it, it is creating a new flow everytime it adds a new item.

Cheers

Sweet, that worked great! Thank you so much for sharing this solution.

This was about when an item is created or modified. Now I want to delete an item that was added to a users calendar via Flow, would this be possible?

Hi @AndriesJ,

 

I don;'t think that you can get to the metadata for the deleted item. I looked into getting the metadata from the recycle bin item using REST API, but that also doesn't give you much detail.

Helpful resources

Announcements

Announcing | Super Users - 2023 Season 1

Super Users – 2023 Season 1    We are excited to kick off the Power Users Super User Program for 2023 - Season 1.  The Power Platform Super Users have done an amazing job in keeping the Power Platform communities helpful, accurate and responsive. We would like to send these amazing folks a big THANK YOU for their efforts.      Super User Season 1 | Contributions July 1, 2022 – December 31, 2022  Super User Season 2 | Contributions January 1, 2023 – June 30, 2023    Curious what a Super User is? Super Users are especially active community members who are eager to help others with their community questions. There are 2 Super User seasons in a year, and we monitor the community for new potential Super Users at the end of each season. Super Users are recognized in the community with both a rank name and icon next to their username, and a seasonal badge on their profile.    Power Apps  Power Automate  Power Virtual Agents  Power Pages  Pstork1*  Pstork1*  Pstork1*  OliverRodrigues  BCBuizer  Expiscornovus*  Expiscornovus*  ragavanrajan  AhmedSalih  grantjenkins  renatoromao    Mira_Ghaly*  Mira_Ghaly*      Sundeep_Malik*  Sundeep_Malik*      SudeepGhatakNZ*  SudeepGhatakNZ*      StretchFredrik*  StretchFredrik*      365-Assist*  365-Assist*      cha_cha  ekarim2020      timl  Hardesh15      iAm_ManCat  annajhaveri      SebS  Rhiassuring      LaurensM  abm      TheRobRush  Ankesh_49      WiZey  lbendlin      Nogueira1306  Kaif_Siddique      victorcp  RobElliott      dpoggemann  srduval      SBax  CFernandes      Roverandom  schwibach      Akser  CraigStewart      PowerRanger  MichaelAnnis      subsguts  David_MA      EricRegnier  edgonzales      zmansuri  GeorgiosG      ChrisPiasecki  ryule      AmDev  fchopo      phipps0218  tom_riha      theapurva  takolota     Akash17  momlo     BCLS776  Shuvam-rpa     rampprakash   ScottShearer     Rusk   ChristianAbata     cchannon   Koen5     a33ik        AaronKnox        Matren        Alex_10        Jeff_Thorpe        poweractivate        Ramole        DianaBirkelbach        DavidZoon        AJ_Z        PriyankaGeethik        BrianS        StalinPonnusamy        HamidBee        CNT        Anonymous_Hippo        Anchov        KeithAtherton        alaabitar        Tolu_Victor        KRider        sperry1625        IPC_ahaas      zuurg     rubin_boer     cwebb365       If an * is at the end of a user's name this means they are a Multi Super User, in more than one community. Please note this is not the final list, as we are pending a few acceptances.  Once they are received the list will be updated. 

Microsoft Power Platform | March 2023 Newsletter

Welcome to our March 2023 Newsletter, where we'll be highlighting the great work of our members within our Biz Apps communities, alongside the latest news, video releases, and upcoming events. If you're new to the community, be sure to subscribe to the News & Announcements and stay up to date with the latest news from our ever-growing membership network who find real "Power in the Community".        LATEST NEWS Power Platform Connections Check out Episode Five of Power Platform Connections, as David Warner II and Hugo Bernier chat with #PowerAutomate Vice President, Stephen Siciliano, alongside reviewing out the great work of Vesa Juvonen, Waldek Mastykarz, Maximilian Müller, Kristine Kolodziejski, Danish Naglekar, Cat Schneider, Victor Dantas, and many more.       Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show!   Did you miss an episode?  Catch up now in the Community Connections Galleries Power Apps, Power Automate, Power Virtual Agents, Power Pages     Power Platform leading a new era of AI-generated low-code development.   **HOT OFF THE PRESS** Fantastic piece here by Charles Lamanna on how we're reinventing software development with Copilot in Power Platform to help you can build apps, flows, and bots with just a simple description! Click here to see the Product Blog         Copilot for Power Apps - Power CAT Live To follow on from Charles' blog, check out #PowerCATLive as Phil Topness gives Clay Wesener Wesner a tour of the capabilities of Copilot in Power Apps.           UPCOMING EVENTS   Modern Workplace Conference Check out the Power Platform and Microsoft 365 Modern Workplace Conference that returns face-to-face at the Espace St Martin in Paris on 27-28th March. The #MWCP23 will feature a wide range of expert speakers, including Nadia Yahiaoui, Amanda Sterner, Pierre-Henri, Chirag Patel, Chris Hoard, Edyta Gorzoń, Erika Beaumier, Estelle Auberix, Femke Cornelissen, Frank POIREAU, Gaëlle Moreau, Gilles Pommier, Ilya Fainberg, Julie Ecolivet, Mai-Lynn Lien, Marijn Somers, Merethe Stave, Nikki Chapple, Patrick Guimonet, Penda Sow, Pieter Op De Beéck, Rémi Riche, Robin Doudoux, Stéphanie Delcroix, Yves Habersaat and many more.  Click here to find out more and register today!     Business Applications Launch 2023 Join us on Tuesday 4th April 2023 for an in-depth look into the latest updates across Microsoft Power Platform and Microsoft Dynamics 365 that are helping businesses overcome their biggest challenges today. Find out about new features, capabilities, and best practices for connecting data to deliver exceptional customer experiences, collaborating and creating using AI-powered capabilities, driving productivity with automation, and building future growth with today’s leading technology. Click Here to Register Today!       Power Platform Conference 2023 We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5th, 2023! But first, let's take a look below at some fun moments from MPPC 2022 in Orlando Florida. 2023 sees guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, and many more taking part, so why not click the link below to register for the #PowerPlatformConf today! Vegas, baby! Click Here to Register Today!      COMMUNITY HIGHLIGHTS Check out our top Super and Community Users reaching new levels!  These hardworking members are posting, answering questions, kudos, and providing top solutions in their communities.   Power Apps:  Super Users:  @WarrenBelz  |  @iAm_ManCat  Community Users: @LaurensM | @Rusk | @RJM07    Power Automate:   Super Users: @abm  | @Expiscornovus | @RobElliott  Community Users:  @grantjenkins | @Chriddle    Power Virtual Agents:   Super Users: @Expiscornovus | @Pstork1  Community Users: @MisterBates | @Jupyter123 | Kunal K   Power Pages: Super Users:  @OliverRodriguesOliverRodrigues | @Mira_Ghaly  Community Users: @FubarFubar | @ianwukianwuk  LATEST PRODUCT BLOG ARTICLES  Power Apps Community Blog  Power Automate Community Blog  Power Virtual Agents Community Blog  Power Pages Community Blog  Check out 'Using the Community' for more helpful tips and information:  Power Apps, Power Automate, Power Virtual Agents, Power Pages 

Register now for the Business Applications Launch Event | Tuesday, April 4, 2023

Join us for an in-depth look into the latest updates across Microsoft Dynamics 365 and Microsoft Power Platform that are helping businesses overcome their biggest challenges today.   Find out about new features, capabilities, and best practices for connecting data to deliver exceptional customer experiences, collaborating, and creating using AI-powered capabilities, driving productivity with automation—and building towards future growth with today’s leading technology.   Microsoft leaders and experts will guide you through the full 2023 release wave 1 and how these advancements will help you: Expand visibility, reduce time, and enhance creativity in your departments and teams with unified, AI-powered capabilities.Empower your employees to focus on revenue-generating tasks while automating repetitive tasks.Connect people, data, and processes across your organization with modern collaboration tools.Innovate without limits using the latest in low-code development, including new GPT-powered capabilities.    Click Here to Register Today!    

Power Platform Connections - Episode 5 | March 16, 2023

Episode Five of Power Platform Connections sees David Warner and Hugo Bernier talk to Vice President of Power Automate, Stephen Siciliano, alongside the latest news, product reviews, and community blogs.     Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show!      Show schedule in this episode:  0:00 Cold Open  0:34 Show Intro  01:09 Stephen Siciliano Interview  30:42 Blogs & Articles  31:06 PnP Weekly Ep 200  32:51 SharePoint Custom Form Backup  33:38 Power Apps Extreme Makeover  34:56 ChatGPT Control  35:35 Color Data  37:17 Top 7 Features on Dynamics 365 2023 Release Wave 1  38:30 Outro & Bloopers  Check out the blogs and articles featured in this week’s episode:    https://pnp.github.io/blog/microsoft-365-pnp-weekly/episode-200/​ (no tags)   https://grazfuchs.net/post/sharepoint-customform-backup/ @Maximilian Müllerhttps://www.fromzerotoheroes.com/ @Kristine Kolodziejski​ https://github.com/Power-Maverick/PCF-Controls/tree/master/ChatGPTControl @DanzMaverick https://yerawizardcat.com/color/ ​ @CatSchneider https://events.powercommunity.com/dynamics-power-israel/ @VictorDantas  Action requested: Feel free to provide feedback on how we can make our community more inclusive and diverse.  This episode premiered live on our YouTube at 12pm PST on Thursday, 16th March 2023.  Video series available at Power Platform Community YouTube channel.    Upcoming events:  Business Applications Launch – April 4th – Free and Virtual! M365 Conference - May 1-5th - Las Vegas Power Apps Developers Summit – May 19-20th - London European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas  Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community  If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.     

Check out the new Power Platform Communities Front Door Experience!

We are excited to share the ‘Power Platform Communities Front Door’ experience with you!   Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well.   Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities.     Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform.      Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.

Microsoft Power Platform Conference | Registration Open | Oct. 3-5 2023

We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida.   Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more.   Register today: https://www.powerplatformconf.com/   

Top Solution Authors
Users online (3,822)