Hi all,
I wonder if there is a way of adding attachments to an email flow sends on a daily basis, and displays the previous days entries in to a SharePoint list.
I have attempted the following but got an error, which I believe is related to the get attachment and get attachment content not being the parent.
My issue is, my Send Email action, contains some actions from the previous loop, so only 1 will work, either the convert time loop or get attachment loop:
If i try it this way, I cannot add the output from the HTML table:
any suggestions please, worst case scenario would be to add a link to the item, but unsure how to do that?
Solved! Go to Solution.
Hello @G99 ,
you'll need 'Apply to each' separate from all the 'Select' action, only the attachments actions should be in the 'Apply to each'. You'll need also an array variable.
The value you'll append into the array variable should look as below:
{
"Name": <DisplayName>,
"ContentBytes": <AttachmentContent>
}
After all the loops you can continue with the 'Select 2' and use the array variable in the send an email action.
I wrote an article on this topic on my blog, in your situation you'll just need one more 'Apply to each' at the beginning to get attachments from all the items.
Yes @G99 , you can use any value for the file name as long as it has the correct extension. You can for example add a 'Compose' action before the 'Append to array variable', in that 'Compose' action enter the dynamic content representing item ID, some separator character, and then the file name.
You can then use in the 'Append to array variable' the output from 'Compose' as the file name.
I am not clear on your requirement. Do you want to actually email the attachments? Do you want to send an email listing new items from the previous day that had attachments? Something else?
Currently what I am doing is emailing the previous days logged items, and in my table, I am using the has attachments properties, which only displays true or false.
Rather than/in addition the users have asked if it is possible to include the attachments with the name being the RefNo. for those items.
If that is not possible, then a link to each attachment to be provided along with the other data the flow is providing.
Thanks
Hello @G99 ,
you'll need 'Apply to each' separate from all the 'Select' action, only the attachments actions should be in the 'Apply to each'. You'll need also an array variable.
The value you'll append into the array variable should look as below:
{
"Name": <DisplayName>,
"ContentBytes": <AttachmentContent>
}
After all the loops you can continue with the 'Select 2' and use the array variable in the send an email action.
I wrote an article on this topic on my blog, in your situation you'll just need one more 'Apply to each' at the beginning to get attachments from all the items.
HI @tom_riha
Thanks for that
I thought I have tried what you have suggested but clearly im missing something as when I go to select AttachmentContent in Append to array variable, i cannot select it from dynamic content please see snippet:
You're missing the 'Get attachment content' action right before the 'Append to array variable'.
@tom_riha
Aha, so I was, Thanks for spotting that.
I've been down this route (or similar) now I cannot set the Name: <DisplayName> this does not appearbut also when I go to the send email action, I cannot select in Attachment content - the Attachment Array, it's not visible for me in the listThis was another of my errors, I had to 'switch to input entire array'
Just need to figure out why I cannot now see the display name
Sorry I have been trying different things but cannot get the display name to appear, when you get a chance please help further:
The 'DisplayName' should be the output from 'Get attachments' (and the reason why the 'Apply to each' was originally added), it must be somewhere among the dynamic content.
The whole attachment processing part must be inside the first 'Apply to each'.
In the same way you had it before:
Thanks so much for your help
re-did that apply to each bit again and the flow ran successfully but the image (attachment) cannot be opened - I'll google why that wont work - this is a steep learning curve!
Remove the < and > from the value, I used them to mark the placeholder, I guess I should've mentioned that earlier 🤔. It should be only the dynamic content behind the colon (and comma after the DisplayName to mark end of line).
"Name": DisplayName,
"ContentBytes": AttachmentContent
Not sure I follow as I do not have <and> in there anywhere...
I found some stuff on line I tried it but to no avail:
Now you have quotes " on the place of the < >, remove them.
Sorry 1 more question comes to mind, hope you dont mind?
Is there a way of adding the RefNo value to each attachment name when its emailed?
Yes @G99 , you can use any value for the file name as long as it has the correct extension. You can for example add a 'Compose' action before the 'Append to array variable', in that 'Compose' action enter the dynamic content representing item ID, some separator character, and then the file name.
You can then use in the 'Append to array variable' the output from 'Compose' as the file name.
Top man, thanks for all your help that works
Oddly when ever i make a change to the append to array variable, i have to re-type that entire bit in, never works when I edit, not biggy though, main thing is a very minor work around - but hopefully no further changes to it
Hello,
Just built flow like yours. But get this error message:
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
14 | |
13 | |
11 | |
10 | |
9 |
User | Count |
---|---|
31 | |
21 | |
16 | |
14 | |
12 |