cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

How to post a message in Microsoft Teams if an event exists on a SharePoint calendar

I would like to create a flow that automatically posts a message in a Microsoft Teams channel if an event exists on a SharePoint calendar for the current day.

 

The message in Microsoft Teams would include event details. 

 

Please share any ideas for how to create this. 

 

5 REPLIES 5
Highlighted
Community Support
Community Support

Re: How to post a message in Microsoft Teams if an event exists on a SharePoint calendar

Hi @kelliprieto,

 

Do you want to check if there is an event existing on current day and then post a message to Microsoft Teams?

 

I have made a test on my side and please take a try with the following workaround:

  • Add a Recurrence trigger, Interval set to 1 and Frequency set to Day.
  • Add a "Get items" action, specify Site Address and List Name set to your Event list as a custom value.
  • Add a "Filter array" action, From set to output of "Get items" action. Click "Edit in advanced mode", type the following formula:

 

@equals(formatDateTime(item()?['EventDate'], 'MM/dd/yyyy'), utcNow('MM/dd/yyyy'))

 

  • Add a Condition, click "Edit in advanced mode", type the following formula:

 

@not(empty(body('Filter_array')))

 

  • Within "If/yes" branch of Condition, add a "Select" action, From set to output of "Filter array" action, Within Map entry, type 5 entries as below:

The key of first entry set to Event Title and the corresponding value set to following formula:

 

item()?['Title']

The key of second entry set to Start Time and the corresponding value set to following formula:

 

 

item()?['EventDate']

The key of third entry set to End Time and the corresponding value set to following formula:

 

 

item()?['EndDate']

The key of forth entry set to Description and the corresponding value set to following formula:

 

 

item()?['Description']

The key of fifth entry set to Location and the corresponding value set to following formula:

 

 

item()?['Location']

 

Then add a "Create HTML table" action, From set to output of "Select" action, Include Headers field set to Yes.

 

Add a "Post message" action, Message field set to output of "Create HTML table" action.

 

Image reference:15.JPG

16.JPGThe flow works successfully as below:17.JPG

18.JPG

 

 

Best regards,

Kris 

 

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper III
Helper III

Re: How to post a message in Microsoft Teams if an event exists on a SharePoint calendar

Kris,

 

Thank you! This is very helpful. 

 

I tested the flow but did not receive the expected results. I have an all day event on the SharePoint calendar for today but a message was not posted to Teams and the flow results indicate no events matched the date/time condition. 

 

Kelli

Highlighted
Community Support
Community Support

Re: How to post a message in Microsoft Teams if an event exists on a SharePoint calendar

Hi @kelliprieto,

 

Could you please show a bit more about the All-Day event that you mentioned within your SharePoint calendar list?

 

I have created an All-Day calendar event in my SharePoint calendar list and the details as below:2.JPG

 

 

I have made a test on my side based on the date/time condition that I provided before and the flow works well. My flow's configuration as below:3.JPG

The flow works successfully as below:4.JPG

The All-Day event in my SharePoint calendar list today could be retrieved as above.

 

Please check if you have typed proper formula within Condition box of the Filter array action within your flow.

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper III
Helper III

Re: How to post a message in Microsoft Teams if an event exists on a SharePoint calendar

Kris, 

 

My flow and event is setup the same way as shown in your screenshots. 

 

I would share screenshots of my flow and event, but I do not see an option in the rich text editor to upload images. I have an event on the calendar today and when the flow runs the flow shows the condition was not met. This is not expected since today's calendar event should be recognized and a reminder should be sent.

 

Kelli

Highlighted
Helper III
Helper III

Re: How to post a message in Microsoft Teams if an event exists on a SharePoint calendar

Kris,

 

I was able to get this flow to work by adding a number to the "Top Count" field in the Get Items step. It appeared the flow was only looking at a subset of the calendar events. 

 

Now, I am trying to figure out how to add space between the table columns. The text is too close together. Can this be achieved?

 

I am also seeing this issue now:

 

The execution of template action 'Select' failed: The evaluation of 'query' action 'where' expression '{ "Title": "@formatDateTime(item()?['Title'],'MM/dd')", "Start": "@formatDateTime(item()?['EventDate'],'MM/dd')", "End": "@formatDateTime(item()?['EndDate'],'MM/dd')" }' failed: 'In function 'formatDateTime', the value provided for date time string 'Peggy - Vacation' was not valid. The datetime string must match ISO 8601 format.'.

 

Kelli

Helpful resources

Announcements
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
Users online (10,932)