cancel
Showing results for 
Search instead for 
Did you mean: 

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:

Screen Shot 2018-09-10 at 9.36.13 AM.png

 

 

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

 

Screen Shot 2018-09-10 at 9.37.13 AM.png

 

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:

Screen Shot 2018-09-10 at 9.47.42 AM.png

 

 

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

Screen Shot 2018-09-10 at 9.47.46 AM.png

 

 

 

 

6.  Finally, add a Teams - Post to Channel action.  Point this to your Team and Channel and set the value to your HTML Output

Screen Shot 2018-09-10 at 9.47.47 AM.png

 

 

 

You can use this same method to send a daily email of the current day's events as well.  Hope this was helpful!

Comments

That should be pretty easy to do.  If you set the Flow to run once a week at the start of the week then the only thing you'd need to change in the directions is the Recurrance settings and the filter in the Get items.  If you change the "Less Than" function to this:  

 

addDays(utcNow(),5,'yyyy-MM-ddT00:00:00Z')

That should be the events from the start of the week plus 5 (typical work week).

 

Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, TechCommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 12 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/