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 / Recreating Recurring S...
Power Automate
Unanswered

Recreating Recurring Sharepoint Calendar Events

(1) ShareShare
ReportReport
Posted on 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

Categories:
I have the same question (0)
  • Jrogles Profile Picture
    29 on at

    cleaning up thread

  • Jrogles Profile Picture
    29 on at

    more cleanup

  • Jrogles Profile Picture
    29 on at

    thread cleanup, made a lot of progress

  • Jrogles Profile Picture
    29 on at

    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 at

    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?

  • Verified answer
    Jrogles Profile Picture
    29 on at

    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')}"
    }

  • whcweb Profile Picture
    4 on at

    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"
    ]
    }
  • Michael_P Profile Picture
    2 on at

    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

  • Community Power Platform Member Profile Picture
    on at

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

  • Spreij Profile Picture
    2 on at

    @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? 

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

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard