cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TomTT
Helper II
Helper II

Bad Gateway in KalenderFlow P0werautomate

 

Hello,

I want to transfer events from a M365 calendar to an event list in Sharepoint.

In the first step I used the GroupID via Azure and in MS Graph I got the Calendar Id, but when I then use the Flow I get the following Error. Maybe someone can help me

What is the problem?Bildschirmfoto 2022-01-26 um 14.52.43.pngBildschirmfoto 2022-01-26 um 14.53.38.png

 

7 REPLIES 7
Mister_Shaik
Super User
Super User

Hi @TomTT ,

 

Where are the calendar events residing? Is it in your personal calendar or on a Shared Mailbox calendar?

 

If it's on a Shared Mailbox calendar, you can first add it to your outlook, which will make it visible in the calendar dropdown for "Get Events" action.

Mister_Shaik_0-1643216609378.png

 

This way you won't face any issues with fetching the events from a calendar.

 

Hope you find this helpful!

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @Mister_Shaik ,

This is a group calendar M365, I am also owner of the team, but I cannot add the calendar to Outlook.

I get the following error message.

Team "Xyz" cannot be added. You may not have the necessary permissions. Is there any solution?Bildschirmfoto 2022-01-27 um 08.32.10.pngBildschirmfoto 2022-01-27 um 08.30.11.png

Hi @TomTT ,

 

I see that you're using a office 365 group calendar instead of a SharedMailbox calendar or a personal calendar.

 

We can't use the Office 365 Outlook connector to grab events from a o365 group calendar, instead we have to use the Office 365 groups connecter. In this connector, there's an action called "Send an http request", which can be used to call the graph APIs to grab the calendar events.

 

2.connectors.PNG

 

1. http action.PNG

https://graph.microsoft.com/v1.0/groups/{group id}/events?$filter=start/dateTime ge #yourDateToFilter

 

So, now you don't need to worry about any permissions and use this directly to fetch events from graph. Also you can filter the events by start datetime or subject or body etc.,

 

Again, why are we using this action? well, because there is no direct action to fetch events from a O365 group calendar.

 

Hope this helps 🙂

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

TomTT
Helper II
Helper II

@Mister_Shaik 

 

Hi, I tried to set up the query so that I get all new appointments listed, unfortunately I get the following error message. What am I doing wrong?Bildschirmfoto 2022-01-31 um 13.41.03.pngBildschirmfoto 2022-01-31 um 13.40.46.png

Mister_Shaik
Super User
Super User

Hi @TomTT ,

 

You need to enclose your addDays(#date) expression in single quotes,

 

https://graph.microsoft.com/v1.0/groups/{group id}/events?$filter=start/dateTime le 'addDays(#date)'

 

Please let me know if this helps 🙂

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

 

Hi Bildschirmfoto 2022-02-01 um 10.44.49.pngBildschirmfoto 2022-02-01 um 10.44.40.pngBildschirmfoto 2022-02-01 um 10.44.26.pngBildschirmfoto 2022-02-01 um 10.56.08.png@Mister_Shaik 

I can now retrieve the calendar entries, I have set the expression to addDays(utcNow(),0), and the flow runs via the Recurrence trigger once a day. How can I filter this so that only new entries in the group calendar are filtered and then filtered by parsing the JSON and added to the SharePoint event list?

When running the flow I get the following error in the value of the start and end date.

 

""Flow save failed with code 'OpenApiOperationParameterValidationFailed' and message 'Input parameter 'item' validation failed in workflow operation 'Create_item': The parameter with value '"@body('Parse_JSON')?['properties']?['value']?['items']?['properties']?['start']"' in path 'item/EventDate' with type/format 'Object' is not convertible to type/format 'String/date-time'.'.""Parse JSON Output.png

 

Show Screen, Thanks for the help

Sorry for my English

Mister_Shaik
Super User
Super User

Hi @TomTT ,

 

I'm assuming that you're trying to get all future events from O365 group calendar, then create those events into the SharePoint Events list.

 

Now your issue is that you don't want to add the same event twice into the calendar?

 

Well, there are multiple scenarios you need to consider before jumping in.

- A new event has been created in the group calendar - You need to create a new item in SP List

- A event already created might have been edited and moved to a different date - You need to update the exact existing event in the SP List

- An event might have been cancelled - Based on your preference, you can either delete the event from list or update the status as cancelled

 

Here's how I'd do it.

 

  1. For the first time, I won't write any conditions and just add all existing events from group calendar into the SP list - I'll add a column called EventID to identify events from group calendar
  2. Once the initial sync is done, I'll add filter clauses as below
    1. StartDateTime >= today and (Modified > (Now - 1 day) || Created > (Now - 1 day)) - This way I'm only getting the events whose start date is greater than or equal to today and are modified or created after the last flow run
  3. I'll loop through all the events I get from the "get events" http action and add below actions in loop,
    1. Condition to check if the event exists in list by checking for EventID, using "get Items" action filter clause
      1. Update the event - new date time or cancellation status
    2. Else
      1. Create event with event ID

 

This way, you'll be covering all scenarios of Calendar sync to SP.

 

Coming to the your actual issue, I noticed that you're passing the whole object to the SP create Item action date field. Instead you only need to pass the dateTime string. Replace your start and end values with this expressions

 

Start: body('Parse_JSON')?['properties']?['value']?['items']?['properties']?['start']?['dateTime']

End: body('Parse_JSON')?['properties']?['value']?['items']?['properties']?['end']?['dateTime']

 

 

Kind Regards,

Shaik Sha
________________________________________________________________________

If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,907)