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
Community Champion
Community Champion

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
Community Champion
Community Champion

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
Community Champion
Community Champion

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
Community Champion
Community Champion

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
Community Champion
Community Champion

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

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
Community Champion
Community Champion

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

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,786)