In my last post I have show how to post one message per day to a Teams channel. In this post I am going to show you how you can enhance the Microsoft Flow to send out multiple messages at the same time.
The flow is basically the same as in the previous post, with two changes:
- Get a row is replaced by List rows present in a table
- Post to Teams is replaced by an Apply to each which triggers a post to Teams
Check for available content for the day and load it
To check if content is available for the day the "List rows present in a table" action is used as it gives multiple results compared to "Get a row", which only gives the first result.
To get the data you want, you need to enter the following fields:
- Location: The location where your Excel is saved
- Document Library: The document library where your Excel is saved
- File: The path to the file
- Table: The table to use in the Excel
- Filter query: The filter for the data
ID eq 'formatDateTime(utcNow(), 'yyyy-M-d')'. The format in formatDateTime has to match with the formula you use in the Excel to calculate the ID. Also note the ' before and after the formatDateTime, don't forget these as otherwise it will not work.
Post the content to a teams channel
To post this content now to a teams channel, you need the "Apply to each" action with the "value" of the "List rows present in a table" variable. This means that there will be a loop over all results of "List rows present in a table". In the "Apply to each" you take the same "Post message in a chat or a channel" to post the message.