I have a setup that is exporting all the json files generated from an API sent to an email address upon a request sent to a shared mailbox, but the thing is that currently logic app is sending out separate emails, one json per email, so it's 7 emails in my case.
My final solution would be sending all the json files in one email. Have tried to figure out the connector methods, but seems that I cannot find that out. Tried to Google of course, but no luck.
Would really appreciate any help!
Current setup looks like this:
Azure Logic App 1:
Azure Logic App 2:
You need to build an array of all of the attachments outside of the loop.
This is the flow I tested with ...
... the two important points are:
As you can see, I've declared a variable at the top Attachments
of type Array
.
Get your blobs and then loop over each one of them.
Within the loop, get the contents of the blob and then add an object to the array that looks like the following JSON structure ...
This is the Peek Code
of the array item, noting that I am encoding the content as base64
...
{
"inputs": {
"name": "Attachments",
"value": {
"ContentBytes": "@{base64(body('Get_blob_content_(V2)'))}",
"Name": "@{items('For_Each_Blob')?['DisplayName']}"
}
}
}
Now, when you send the email, refer to the array as the contents of the Attachments
parameter.
That should get the job done for you, it worked for me.