Attachments and Report in same email Power Automate

167
3
2 weeks ago
j-bromp
New Contributor III

Hi There,

Is it possible to send an email that contains both a created report and the images from a survey as attachments?

If I have an array attachment to my email that contains both reports and the array variable containing my survey images the image file is unreadable, even when manually changing name to include '.jpg'. The created reports still come through fine in this way.

If i remove the reports and have just an array with only the array variable as an attached array the image comes through fine via email. 

I can only get the images to show if send two different emails, one for the created reports and one for the images. This is not ideal as you can imagine.

jbromp_0-1715220930166.png



Ideally I'd have attachments and reports in the same email.

jbromp_1-1715221057029.png

 



But this causes the error when opening the image attachment.

Cheers!

0 Kudos
3 Replies
RobertAnderson3
MVP Regular Contributor

The way I ended up doing this is by appending both the report from Survey123 (which I've created using the Create Report action instead of the HTTP method) and the attachments into the array, and then just putting the array variable into the attachment of the email and it seems to work.

My flow is triggered by the submission of a survey so I get the token and attachments dynamic content from it. Using the dynamic content for the naming of the attachments might help looking at your flow. I've got an apply to each around the attachments, and then appending the report is after that.

RobertAnderson3_0-1715255367546.png

Using the orange ArcGIS connector, there is also the "Get attachments" action which could be used instead of the HTTP if you have premium which might help get the details of each attachment.

0 Kudos
abureaux
MVP Regular Contributor

Attach arrays are the solution.

However, be aware that there is an annoying and arbitrary array limit in Power Automate, so expect to run into that if you attach too many (large) items.

Also, ensure that your Exchange server has the attachment limit turned up. I believe 50 MB is the current limit. Sometimes, it's best to dump photos elsewhere.

0 Kudos
abureaux
MVP Regular Contributor

Also, just in case @j-bromp or another user comes across this thread and decides they also want to use this attach array in something like a Teams approval, you can't. You need a second attach array for that.

Emails (e.g., Send and Email V2) uses ContentBytes.

[
  {
    "Name": "My name",
    "ContentBytes": "My content"
  }
]

Teams Approvals uses content

[
  {
    "name": "My name",
    "content": "My content"
  }
]

And one last thing. You should always assume that things like this are case sensitive. So please also include the case as it appears here.