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

Community site session details

Session Id : VUbHp9FjwR3ezI/oww1vYT
Power Automate - Building Flows
Answered

Recreating Recurring Sharepoint Calendar Events

Like (1) ShareShare
ReportReport
Posted on 13 Mar 2019 19:35:06 by 29

I'm trying to make a daily flow that checks a sharepoint site's event calendar, and any event marked as birthday (or recurring/etc) -- I'd like to create a new event with all of the same information except the start and end date's year is incremented by one. I'm trying to sidestep the modern ui's ignoring of recurring events, while also avoiding having to make an event: every year for every employee.

 

*** Updated the main post instead of replying: ***

 

Current Problem:

502 Bad Gateway on the HTTP Request to Sharepoint trying to Update the Create Item with the fAllDayEvent param set to true. Any help is greatly appreciated on the HTTP Request.

 

 

Current Flow:

Screen Shot 2019-03-14 at 10.36.33 PM.pngScreen Shot 2019-03-14 at 10.36.53 PM.pngScreen Shot 2019-03-14 at 10.37.30 PM.pngScreen Shot 2019-03-14 at 10.37.47 PM.png

 

Current Failed Test with a 502 Bad Gateway -- Event Time Date Error

Screen Shot 2019-03-14 at 10.33.32 PM.pngScreen Shot 2019-03-14 at 10.33.54 PM.pngScreen Shot 2019-03-14 at 10.34.07 PM.pngScreen Shot 2019-03-14 at 10.34.17 PM.pngScreen Shot 2019-03-14 at 10.34.26 PM.pngScreen Shot 2019-03-14 at 10.35.07 PM.pngScreen Shot 2019-03-14 at 10.35.23 PM.pngScreen Shot 2019-03-14 at 10.35.35 PM.pngScreen Shot 2019-03-14 at 10.35.48 PM.png

 

More on the error:

Screen Shot 2019-03-14 at 11.00.32 PM.pngThe Events are still made:

Screen Shot 2019-03-15 at 12.30.06 PM.png

I have the same question (0)
  • Spreij Profile Picture
    2 on 08 Oct 2021 at 10:14:39
    Re: Recreating Recurring Sharepoint Calendar Events

    @Jrogles 

     

    Thanks for working this out. Was hoping to use it but I seem to get a error message saying: Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The action(s) 'CheckIfItExists' referenced by 'inputs' in action 'Condition_2' are not defined in the template.'.'.

     

    I followed only your solution steps, reading old informatie I found that CheckifitExists is often overcome by things like this solution: https://powerusers.microsoft.com/t5/Building-Flows/How-to-check-if-an-item-exists-on-a-SharePoint-list/m-p/60634#M5599  . However I do not see that in one way or a other set in your solution. Did I miss something? Where did you define CheckIfitExists or how should I go about it? 

  • Community Power Platform Member Profile Picture
    on 24 Jun 2020 at 15:53:01
    Re: Recreating Recurring Sharepoint Calendar Events

     can you list out some of the custom variables for what you did here? I am trying to recreate but can't see everything

  • Michael_P Profile Picture
    2 on 10 Aug 2019 at 06:02:04
    Re: Recreating Recurring Sharepoint Calendar Events

    WHCWeb

     

    I ran into the same error: "A type named 'SP.Data.EventsListItem' could not be resolved by the model"

     

    I resolved it by updating the reference to "Events" in the "SP.Data.EventsListItems" to match the name of my calendar/list.  The example json code provided assumes the calendar/list is called "Events".  If it is not, then you need to update the json code.  If your calendar/list is call "Example" then you need to change the code to refer to "SP.Data.ExampleListItem".

     

    In my case, my list was called "Birthdays" which meant I had to update the body json code to (bold emphasis added):

     

    {
    "__metadata": {
    "type" : "SP.Data.BirthdaysListItem"},
    "fAllDayEvent" : "True",
    "EventDate" :"@{formatDateTime(triggerBody()?['EventDate'],'M/d/yyyy')}",
    "EndDate" :"@{formatDateTime(triggerBody()?['EventDate'],'M/d/yyyy')}"
    }

     

    Hope this helps.

     

    Regards

     

    Michael

  • whcweb Profile Picture
    4 on 12 Jul 2019 at 23:57:50
    Re: Recreating Recurring Sharepoint Calendar Events

    Trying to update SharePoint Online Event list using MS flow HTTP to Sharepoint Action but running into the following error "A type named 'SP.Data.EventsListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type."

     

    Any ideas what I am doing wrong or missing?  Below is my Request and the Response I get. 

     

    :Request

    Header:
    {
    "Content-Type": "application/json;odata=verbose",
    "IF-MATCH": "*",
    "X-HTTP-Method": "MERGE",
    "Accept": "application/json;odata=verbose"
    }
    Body:
    {
    "__metadata": {
    "type" : "SP.Data.EventsListItem"},
    "fAllDayEvent" : "True",
    "EventDate" : "@{formatDateTime(body('Create_item')['EventDate'],'M/d/yyyy')}",
    "EndDate" : "@{formatDateTime(body('Create_item')['EventDate'],'M/d/yyyy')}"
    }

     

     

    :Response

    {
    "status": 400,
    "message": "A type named 'SP.Data.EventsListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.\r\nclientRequestId: eaae8b9c-8fbc-4513-a14d-de9e581111dd\r\nserviceRequestId: 10acef9e-c0a7-8000-8706-7a79ffb54afa",
    "source": "[tenanturl][site]/_api/web/lists/GetByTitle('Events')/items(429)",
    "errors": [
    "-1",
    "Microsoft.SharePoint.Client.InvalidClientQueryException"
    ]
    }
  • Verified answer
    Jrogles Profile Picture
    29 on 01 Apr 2019 at 03:58:34
    Re: Recreating Recurring Sharepoint Calendar Events

    Solution!! The fAllDayEvent flag needs to be passed with new start/end times with the hh:mm:ss removed.

    Thanks to @v-yamao-msft for pointing me to this article on my other thread.

     

    Here are the two final flows I used (I realize they can be combined) to recreate recurring, all-day events on Sharepoint Online Event Calendars:

     

    Screen Shot 2019-03-31 at 10.40.15 PM.png

     

    Recurring Events:

    Screen Shot 2019-03-31 at 10.50.39 PM.png

     

    addDays function:

    addDays(utcNow('yyyy-MM-dd'),-1,'yyyy-MM-dd')

     

    utcNowfunction:

    utcNow('yyyy-MM-dd')
     
    Category Value contains "Birthdays"
     

    addDays function:

    addDays(utcNow('yyyy-MM-dd'),1,'yyyy-MM-dd')

    Screen Shot 2019-03-31 at 10.51.27 PM.png

    empty function:

    empty(body('CheckIfItExists')?['value'])

     

    Screen Shot 2019-03-31 at 10.51.39 PM.png

     

     

    Make any new Birthday - an all day eventScreen Shot 2019-03-31 at 10.45.41 PM.png

    formatDateTime #1 & #2:

    formatDateTime(triggerBody()?['EventDate'],'M/d/yyyy')

     

    URI:

    _api/web/lists/GetByTitle('Events')/items(@{triggerBody()?['ID']})

     

    Headers:

    {
    "Content-Type": "application/json;odata=verbose",
    "IF-MATCH": "*",
    "X-HTTP-Method": "MERGE",
    "Accept": "application/json;odata=verbose"
    }

     

    Body:

    {
    "__metadata": {
    "type" : "SP.Data.EventsListItem"},
    "fAllDayEvent" : "True",
    "EventDate" :"@{formatDateTime(triggerBody()?['EventDate'],'M/d/yyyy')}",
    "EndDate" :"@{formatDateTime(triggerBody()?['EventDate'],'M/d/yyyy')}"
    }

  • Jrogles Profile Picture
    29 on 25 Mar 2019 at 15:32:00
    Re: Recreating Recurring Sharepoint Calendar Events

    So I think this is boiling down to the fact that the fAllDayEvent isn't being set to a Boolean value for some reason.

     

    Here the new item is set to:

    <d:fAllDayEvent m:null="true" />

     

    Instead of what the existing item's fAllDayEvent is set as:

    <d:fAllDayEvent m:type="Edm.Boolean">true</d:fAllDayEvent>

     

    Not having any luck with these--

    "fAllDayEvent":true

    "fAllDayEvent" : "True"

    "fAllDayEvent" : "true"

    "fAllDAyEvent" : "{expression 'true'}

    Screen Shot 2019-03-25 at 11.22.04 AM.png

     

    How should I format the JSON body of the HTTP request to get the proper syntax on the update-item set?

  • Jrogles Profile Picture
    29 on 20 Mar 2019 at 01:34:04
    Re: Recreating Recurring Sharepoint Calendar Events

    Here is the full text of the 502 Error.

     

    {
    "error": {
    "code": 502,
    "source": "flow-apim-msmanaged-na-eastus2-01.azure-apim.net",
    "clientRequestId": "cbc5a112-576f-4682-b8f4-234058867f03",
    "message": "BadGateway",
    "innerError": {
    "status": 502,
    "message": "Invalid date/time value.\n\nA date/time field contains invalid data. Please check the value and try again.\r\nclientRequestId: cbc5a112-576f-4682-b8f4-234058867f03\r\nserviceRequestId: 50aeca9e-d0f2-8000-7958-ecc8417b6892",
    "source": "____/sites/H20/_api/web/lists/GetByTitle('Events')/items(454)",
    "errors": [
    "-2130575332",
    "Microsoft.SharePoint.SPException"
    ]
    }
    }
    }

     

    I'm really unsure how using the original start time, the add to time action, and a even a formatDateTime can still yield me bad date/time data for entry on the object.

     

    The new event is created fine with those date/times -- so why is updating the all day event flag, throwing an invalid date/time error? Is this completely unsupported functionality for sharepoint calendars now?

     

    Also trying to use the Expression True value for fAllDayEvent param throws a 400 invalid JSON error. 

  • Jrogles Profile Picture
    29 on 14 Mar 2019 at 23:54:48
    Re: Recreating Sharepoint Event a Year Later

    thread cleanup, made a lot of progress

  • Jrogles Profile Picture
    29 on 14 Mar 2019 at 20:50:30
    Re: Recreating Sharepoint Event a Year Later

    more cleanup

  • Jrogles Profile Picture
    29 on 14 Mar 2019 at 20:13:01
    Re: Recreating Sharepoint Event a Year Later

    cleaning up thread

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading started
Loading complete