In this solution, I will provide you the Integration power of Microsoft Flow, Teams and SharePoint Calendars, This solution will provide the functionality to post everyday events into the teams channel, which will help team members to stay in track with the organizations, they stay Informed, and updated about the events are happening around them or in their organization.
This solution also enhances and introduce us about one of the many useful capabilities of Microsoft Teams and its integration enhancements.
Create a Flow
Let us create a Flow, which posts the list of the events of the SharePoint Calendar. Please follow below steps to create a Flow, also I have attached the Flow Template for your reference.
Step 1: Create a Flow from blank without any available templates.
Step 2: Select Schedule and under it selects the recurrence as the trigger as the Flow.
We have to configure the recurrence values as per the below-given Image.
Click on show advanced options and configure the advanced setting so that the Flow runs daily at your convenient time see the below image for reference.
Step 3: Add “Get Items” Action under the SharePoint and provide the URL of the site where the SharePoint Calendar is stored.
Note: As we already know that SharePoint Calendar will not show into the drop-down of list options, so, you have to click on the “Manual” option and type in the name of your SharePoint Calendar.
Configuration is as per given below image
Site Address: SharePoint site address.
List Name: Events (Enter name of your SharePoint Calendar)
Step 4: Now we have all the events of the SharePoint Calendar, for specific days event we need to configure the filter “Get Items Action’s” output so that it’ll get only current day’s Items.
We have some limitation here that we cannot format the SharePoint event date because of its date and time column of SharePoint. In addition, we cannot do simple event date is equal to the today’s date, because the event date is the date and time column as I have mentioned above.
The evaluation will only work if the except date and time matches. For that, we have to configure our condition or say query as the expression to check if the event is between the 12 am and 11:59 pm on the current date as given below Expression.
EventDate ge 'utcNow('yyyy-MM-ddT00:00:00Z')' and EventDate lt 'addDays(utcNow(),1,'yyyy-MM-ddT00:00:00Z')'
Enter the expression into the filter option of the get items action, Click on the Show Advanced options and put the query into the filter as below image.
Step 5: Here in this step we have all information of the SharePoint Calendars events which are going to happen today, or which are there into the SharePoint Calendar. However, we need to get these results into the user-friendly format.
To arranging data into a user-friendly format, we have to insert the Data Operation à Select Action.
Configure the action as per below Image and set the values as per your requirements into the action.
Map: Here we have to provide the title of the structure and value in the next field
Title: Title (Value of the SharePoint Calendar)
Start: Start Time (Start Time of the Event)
End: End Time (End Time of the Event)
Step 6: In the next step, we will insert a “Create HTML table” action under the “Data Operation” so we can arrange our output into the easy to read HTML table layout.
Here we have to use the value of the output of the select action’s output
From: Output of the “Select” action
Step 7: Finally, in this Step, we have all the resources and ready to create new message into the team’s channel.
Add an action named “Post Message” under the “Microsoft Teams”.
Configure the action values as per below given configurations and values
Team ID: Select the team from the drop-down menu
Channel ID: Select the channel from the drop-down menu
Message: Here you have to set the output of the “Create HTML Table” action’s output.
Step 1: Create events into the SharePoint Calendar, or See the events into the outlook calendar.
Please download the source code from below GitHub URL: