Friday, September 13, 2019

Iterate SharePoint list items and send an email to recipient using MS Flow

In this blog, we are going to learn how to iterate the Sharepoint list items and send an email to the recipient using MS Flow and if you are looking a solution to send an email using Sharepoint workflow then you can refer this blog.

I am going to create custom list in modern site and planned to create multiple column in different data types like people picker, lookup column, data & time field to check whether I can get the value from respective column.

As a first step, I just changed the title column as non-required and you can see the remaining columns with data types on below image

And I have filled some information’s in the list, here I can create only two items since I am having only two valid users in my tenant.

Now, we are going to create a flow to send all the list item to any of the recipients. You can go the flow designer either using Flow option from the List ribbon or you can use Tiles from app launcher.

So, as an initial step. We need to create a trigger point. So, I chosen recurrence action and set Interval to run every month in India’s timing.

Second action, selected Sharepoint-get items and provided Site address and List Name

Third action, selected Data operation – Create HTML Table and mapped List items in From column and selected columns as a custom. Then under Header I just typed column header manually like employee name, employee type and so on.

And under Value column, you can use dynamic content option to select the respective values and always prefer to select column values like highlighted below. Otherwise you will not get proper email body.

Fourth action, you can select Compose to convert RAW data with table content and in inputs you can choose replace expression and add below given formula to generate the table border

replace(body('Create_HTML_table'),'<table>','<table border="2">')

And finally, send an email action and add your output in email body (make sure selecting output value under compose category). In this blog I am sending list items to my email ID

And recipient will receive email like below format.

No comments:

Post a Comment