Hi all,
Is it possible to add an array and output as content for an email attachment?
I am trying to create a flow which has two branches, resulting in an email at the end.
On one branch I have a loop that gathers a series of photos from a doc library, and put the photos in an array
On the other branch I have a csv table built on items from a SP List
How can I bring these together as attachments, one being an array and one being output from create file/get file content?
The create email outlook 365 (V2) allows only to use an array or attachment name/content
Or can I add my csv file to the array?
Any help appreciated
Thanks
Solved! Go to Solution.
Thanks for your reply.
Merging two arrays with two different content going to be tricky.
The below link explains how to merge two arrays. Not sure this is useful for your case or not.
https://powerusers.microsoft.com/t5/Building-Flows/Merging-arrays/td-p/386279
Getting large libraries please see below.
https://veenstra.me.uk/2018/05/23/microsoft-flow-querying-large-libraries/
The below link might be useful for attaching multiple contents in a single email
https://flow.microsoft.com/en-us/blog/multiple-attachments-single-email/
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blog
Try the following
Above Append value is as follows:
{
"Name": "test.csv",
"ContentBytes": "@{body('Create_HTML_table')}"
}
Next for the SharePoint how to append the files please have a look at my blog
Finally you will have one append array which you can user for sending as one email with all the attachments.
The key is declare the array variable as a global variable where you can use is any branch of the flow.
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHi @abm,
Thank you for your suggestion.
Unfortunately my flow is failing at the email stage due to bad request.
Perhaps you could look at my flow and see where this might be going wrong?
Thank again
Could you test your logic only with one branch and see that works or not? Then try with other branch. Later combine both. This way you will know which branch is having issues. Let me know how it goes.
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHi @abm,
Thank you for your suggestion, I have done some testing.
I have created a duplicate flow of the 'getting pictures' branch and that works to some extent, but doesn't get all of the pictures which meet the filter query, just some of them. I know they meet the filter query because they all have a common GUID string within the filename. But within the complete flow, as a branch, it doesn't return any attachments. I'm not sure why.
The HTML table branch doesn't work at all. If I use the code you provided for ContentBytes, it says "the expression is invalid", (I have been careful to type it out to avoid apostrophe issues). But your code looks valid to me.
Alternatively if I select the Output from the Create HTML table stage, it says bad request.
Is it worth trying to rebuild the flow? I have my suspicions about the stability of MS Power Automate, it seems quite fragile to change.
Do you think it is possible to create an email with a spreadsheet or table and pictures can be attached, where GUIDs are available to relate from the selected item.
Thank you for your support
Max
Thanks for the reply.
Not sure your append array is creating issues here as it is under a branch. Could you use two different array to append each branch? Then merge into one.
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHi @abm,
Thank you for your continued support
I have settled on a solution where I embed the data into the email body as an HTML table and add only photos to the attachment array. This is producing quite a nice result, and a valuable report for our needs. See below.
I feel that merging the photo array with another array that contains a *.csv file would still be desirable on top of this.
Any advice on how to merge attachment arrays into one single attachment array?
One of the issues was that not all of the photos that matched the filter query were being added to the attachment array.
The solution to this was to put the top count at 5000 in the Get Files (porperties only) action.
It turns out that 'default = all', is just not 'all' at all, as you might expect.
Thanks for your reply.
Merging two arrays with two different content going to be tricky.
The below link explains how to merge two arrays. Not sure this is useful for your case or not.
https://powerusers.microsoft.com/t5/Building-Flows/Merging-arrays/td-p/386279
Getting large libraries please see below.
https://veenstra.me.uk/2018/05/23/microsoft-flow-querying-large-libraries/
The below link might be useful for attaching multiple contents in a single email
https://flow.microsoft.com/en-us/blog/multiple-attachments-single-email/
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogUser | Count |
---|---|
91 | |
44 | |
21 | |
18 | |
16 |
User | Count |
---|---|
134 | |
49 | |
42 | |
36 | |
28 |