cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MarcusD1
Helper I
Helper I

How to add an array of conditional output values (file names) to a single email

I've built a flow to send an email that lists all files in a given folder that have not been modified in the past 24 hours. Everything works great - except it sends a unique email for each file. I want to send a single email with a list of all the files that meet the condition (i.e. haven't been modified in the past 24 hours). My guess is I need to use some kind of array function in the body of the email, but I don't know how to construct that.

 

Help please!

 

MarcusD1_0-1634764644237.png

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
ekarim2020
Super User
Super User

Here is one method that combines a number of steps:

2021-10-20_23-52-49.png

Note that 'Past time' is enclosed in single quotes

2021-10-20_23-53-56.png

Next we Select the the Filename with Extension and Modified date from the data returned by the Get files (properties only) action, convert that to a HTML table and email it to the recipient:

2021-10-20_23-54-25.png

2021-10-20_23-55-23.png

Here is the sample output:

2021-10-20_23-56-21.png

 

You could refine the HTML table by formating the date/time to your locale,  add some simple HTML improve the layout of the table.

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

ekarim2020
Super User
Super User

If you would like to format the date/time and the HTML table that is sent in the email:

2021-10-21_00-30-19.png

We add an expression to format the date and time (note date/time in SharePoint is stored as UTC):

2021-10-21_00-15-40.png

formatDateTime(item()?['Modified'],'yyyy-MM-dd hh:mm')

This is the HTML table formatting code:

2021-10-21_00-21-47.png

You can copy-and-paste the HTML code below:

 

 

<style>
table {
  border: 1px solid #1C6EA4;
  background-color: #EEEEEE;
  width: 100%;
  text-align: left;
  border-collapse: collapse;
  table-layout: auto;
}
table td, table th {
  border: 1px solid #AAAAAA;
  padding: 10px;
}
table tbody td {
  font-size: 13px;
}
table thead {
  background: #1C6EA4;
  border-bottom: 2px solid #444444;
}
table thead th {
  font-size: 15px;
  font-weight: bold;
  text-align: left;
  color: #FFFFFF;
  border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
  border-left: none;
}
</style>

 

 

Add the HTML formatting code to the email:

2021-10-21_00-10-05.png


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

ekarim2020
Super User
Super User

Can you share a screenshot of the Get files (properties only) action and the filter query?

 

2021-10-21_17-10-14.png

You should be able to copy-and-paste the following expression and re-test the flow:

Modified lt '@{body('Get_past_time')}'

 

 

Ellis

View solution in original post

5 REPLIES 5
ekarim2020
Super User
Super User

Here is one method that combines a number of steps:

2021-10-20_23-52-49.png

Note that 'Past time' is enclosed in single quotes

2021-10-20_23-53-56.png

Next we Select the the Filename with Extension and Modified date from the data returned by the Get files (properties only) action, convert that to a HTML table and email it to the recipient:

2021-10-20_23-54-25.png

2021-10-20_23-55-23.png

Here is the sample output:

2021-10-20_23-56-21.png

 

You could refine the HTML table by formating the date/time to your locale,  add some simple HTML improve the layout of the table.

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

ekarim2020
Super User
Super User

If you would like to format the date/time and the HTML table that is sent in the email:

2021-10-21_00-30-19.png

We add an expression to format the date and time (note date/time in SharePoint is stored as UTC):

2021-10-21_00-15-40.png

formatDateTime(item()?['Modified'],'yyyy-MM-dd hh:mm')

This is the HTML table formatting code:

2021-10-21_00-21-47.png

You can copy-and-paste the HTML code below:

 

 

<style>
table {
  border: 1px solid #1C6EA4;
  background-color: #EEEEEE;
  width: 100%;
  text-align: left;
  border-collapse: collapse;
  table-layout: auto;
}
table td, table th {
  border: 1px solid #AAAAAA;
  padding: 10px;
}
table tbody td {
  font-size: 13px;
}
table thead {
  background: #1C6EA4;
  border-bottom: 2px solid #444444;
}
table thead th {
  font-size: 15px;
  font-weight: bold;
  text-align: left;
  color: #FFFFFF;
  border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
  border-left: none;
}
</style>

 

 

Add the HTML formatting code to the email:

2021-10-21_00-10-05.png


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

MarcusD1
Helper I
Helper I

Ellis -

 

Thank you for this excellent guidance! It all works great - but only if I leave out the Get past time element (which results in every record in the file being included). When I include that piece, it throws an error:

 

MarcusD1_0-1634830911984.png

 

I tried removing the "Modified It" part and just using the Past Time element - but that didn't help. Any ideas why it's tripping an error?

ekarim2020
Super User
Super User

Can you share a screenshot of the Get files (properties only) action and the filter query?

 

2021-10-21_17-10-14.png

You should be able to copy-and-paste the following expression and re-test the flow:

Modified lt '@{body('Get_past_time')}'

 

 

Ellis

MarcusD1
Helper I
Helper I

I'm not sure what I was doing wrong when I tried to enter it manually, but the copy/past of the extended expression worked. It works perfectly. Thanks again!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (5,043)