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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.