Get SharePoint Calendar Events and Post to Teams
Hello Flow Fans!
Today I wanted to write about a solution I recently wrote which ties together Flow, SharePoint and Teams. I wanted to utilize a recurring Flow, set to run every day to grab the current days events from a SharePoint calendar and post a message to my Teams channel to let everyone know what events are occuring today. Pretty cool right? Let's take a look at how to set this up.
1. Create a blank Flow and add a Recurrance Trigger. Configure the advanced settings so that the Flow runs every day at 8 per the screenshot below:
2. Add a Get Items - SharePoint Action. Point this to the URL where you SharePoint calendar is stored.
Note: SharePoint Calendars will NOT show in the dropdown of list options. You have to click the "Manual" option and type in the name of your SharePoint Calendar
3. Now we need to configure the Filter options for the Get Items so that it will get only the current day's items. This step is a little tricky. We can't do a simple EventDate eq 'utcNow()' because the EventDate is a Date Time so that evaluation will only work if the exact date and time matches. Additionally, we can't use a formateDate on the EventDate field either. That leaves us with using greater than and less than expressions to check if the event is between the 12am and 11:59pm on the current date as shown below:
EventDate ge 'utcNow('yyyy-MM-ddT00:00:00Z')' and EventDate lt 'addDays(utcNow(),1,'yyyy-MM-ddT00:00:00Z')'
4. We need to get these results in a user-friendly format to post to Teams. To do this, we will insert a "Data Operations - Select" action. Pass in the Values from our Get Items action and fill out the item value pairs for whatever information you want to show as shown in the screenshot below:
5. Next, we'll insert a "Data Operations - HTML" action so that we can format our output into an easy to read HTML table layout
6. Finally, add a Teams - Post to Channel action. Point this to your Team and Channel and set the value to your HTML Output
You can use this same method to send a daily email of the current day's events as well. Hope this was helpful!
Comments
-
Get SharePoint Calendar Events and Post to Teams
Hello @aprildunnam , has anybody figured out how to make the Flow post events that are recurring? Like what is said in prior posts, the Flow works great for events assigned in the current year but fails in year 2 and beyond.
I tried what 'criojsab' did in the post above this one and the Flow picked up every event for the entire year and posted it to my Teams Channel. I had to stop the Flow after it posted over 40 events in 5 minutes. I tried changing "End Date" to "Event Date" and this change didn't work either.
I know this is an old post, so I hope someone sees this and will have a resolution. I can't seem to find anything regarding this issue on the internet.
-
Get SharePoint Calendar Events and Post to Teams
Hi @aprildunnam, I'm having the same issue of the post above. How can you get the recurrence events that are happening in Today?
Found a way to get all the recurrecences :
EventDate le 'EXPRESSION FOR START DATE' and EndDate ge 'EXPRESSION FOR END DATE'
EXPRESSION FOR START DATE: formatDateTime(utcNow(),'yyyy-MM-ddT00:00:00Z')
EXPRESSION FOR END DATE: formatDateTime(utcNow(),'yyyy-MM-ddT23:59:00Z')But if at the the recurrence is too long also will be listed but that doesn't mean that is happening or ocurring today.
More than appreciated any help
-
Get SharePoint Calendar Events and Post to Teams
I had this working perfectly for last year, but I ran into an issue with recurring events on SharePoint. It's almost like my flow isn't seeing any events this year, because they were created as recurring. Is there an easy fix or would I need to recreate every birthday??
-
Get SharePoint Calendar Events and Post to Teams
This solution does not work for recurring events. Has anyone tackled this? I'm seeing that the important recurrence data is not returned in the Get Items JSON.
-
Get SharePoint Calendar Events and Post to Teams
@randallroach Did you ever figure this out? Looking to capture multi-day events as well in my Flow.
-
Get SharePoint Calendar Events and Post to Teams
@aprildunnam hi April, my flow is working great for single day events, but it's (by design) not showing events that span multiple days (e.g. recurring series or multi-day event). is there a way to adjust step 3 so that the flow pulls any appointment that starts on the current day, regardless of when the end date is? thanks!
-
Get SharePoint Calendar Events and Post to Teams
@aprildunnam, worked beautifully, thank you for the remedial help 🙂
-
Get SharePoint Calendar Events and Post to Teams
If you hover over the End Time property you have in your mapping you should see a tooltip pop up that shows a value. It's probably something like item()['EventDate']. That's what you'll want to use in the formatDateTime
-
Get SharePoint Calendar Events and Post to Teams
@aprildunnam, here's a screenshot for context
-
Get SharePoint Calendar Events and Post to Teams
Thanks @aprildunnam, I'm very close. Will you please tell me the correct location to place the expression?
@formatDateTime(utcnow(),'yyyy-MM-dd')
I tried to put it in the Select action to replace the "Start Time" field, but I got an invalid error. I used the code
@formatDateTime(EventDate,'yyyy-MM-dd')
Will you please let me know if I'm placing the code in the right spot & if the code itself is correct? Thanks!
*This post is locked for comments