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

Recreating Recurring Sharepoint Calendar Events

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

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

View solution in original post

9 REPLIES 9
Highlighted
Frequent Visitor

Re: Recreating Sharepoint Event a Year Later

cleaning up thread

Highlighted
Frequent Visitor

Re: Recreating Sharepoint Event a Year Later

more cleanup

Highlighted
Frequent Visitor

Re: Recreating Sharepoint Event a Year Later

thread cleanup, made a lot of progress

Highlighted
Frequent Visitor

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. 

Highlighted
Frequent Visitor

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?

Highlighted
Frequent Visitor

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

View solution in original post

Highlighted
New Member

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"
]
}
Highlighted
New Member

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

Highlighted
New Member

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

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,905)