web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / sennd collection of im...
Power Apps
Unanswered

sennd collection of images to power automate to attach to email

(0) ShareShare
ReportReport
Posted on by 260

In a Power Apps, I am modifying it from capturing a single image to capturing multiple images.  That has been accomplished successfully,  However, the app heretofore sent out an email via Pwer Automate that had a complex HTML body, a captured signature, and the single captured image.  I have not as yet beeen successful to get the flow to attach the collection of images instead of the single image attached before.  I need some help.

 

When all the images have been captured, they are saved to a SharePoint library via another flow, which returns the full file patch of each image.  The app then collects the file paths into a new collection, and it's this collection that is being passed to the flow to send the email (it does a lot of data gathering to build the HTML body prior to the send email step).  When I Json parse the collection, all i get for output is [{},{}] .

 

When I try and attach to V2 send email, Power Automate errors on whichever values I try and use..

 

Lots of good articles on how to send email to multiple users in a collection, or how to attach a collection as an HTML format, but I haven't found out a way to create multiple attachments to a single email from a collection passed to a flow.

Categories:
  • alaabitar Profile Picture
    1,503 Super User 2024 Season 1 on at

    Hello   

    Basically in order to send an email with multiple attachment in a kind of dynamic way, it is about creating an array containing json object with two properties "Name" and "ContentBytes" witch will look like that

     FOTWJan18_5.png
    Instead of sending the collection from PowerApp to Power Automate why don't you just send the id's of the document or the path to a folder containing the document in the sharepoint library and then in Power Automate you loop and create the array.
  • lmheimendinger Profile Picture
    260 on at

    First, the collection I am sending to Power Atomate is the path pf the files saved in SharePoint.  

     

    So if  I understand you correctly, I should do an Apply to which loops through the collection but gets the meta data and content of each stored image, appends those to an array, and then attach the array to the email.

     

    If I have assumed correctly, should Power Automate initilize the passed collection as an array or an object or string?  Any special considerations for Power Automate steps before the pply to step?  I haven't dealt with a collectio being passed before....

     

    Of course, there is the possibility that I should not pass a collection.  But what would I pass intead, a data table obtained from the collection, e.g.?

     

    I think you have starrted me in the right direction though.

  • lmheimendinger Profile Picture
    260 on at

    I forgot to comment on my non-working attemp.  I passed the parameter of a collection of file path names with the expresion  JSON(colPhotoAttchment, JSONFormat.IgnoreBinaryData).

     

    As a step in Power Automate, I did a compose on initialized variable pointing to the parameter, but what I got from that compose was [{},{}] and I couldn't create a step like your Append to Array.

     

    colPhotoAttachment has one column, a string, which contains the full file patch in SharePoint for each image.  Meta Data and file Content steps take this value, as in the single image attachmewnt I previously did.

  • alaabitar Profile Picture
    1,503 Super User 2024 Season 1 on at

    Hello @lmheimendinger 

     

    Yes your assumption is right, the overall idea is to create an array of name and content for each file.
    One question is all your sharepoint file under the same folder ? If yes then you just need to pass from PowerApp to PowerrAutomate the path of the folder and in Power Automate you just then need to loop throught the document in that folder to create your array.

  • lmheimendinger Profile Picture
    260 on at

    Thought I had solved this but can't send email; it failswith MAPI error if I attach the array.

    Here's what I did:

    ----From Power Apps  ---

    • Create a collecton of file paths where images are saved in SharePoint
    • Use that collectionon as variable in Power Automate run as 

    JSON(colPhotoAttchment, JSONFormat.IgnoreBinaryData)

     

    ---In Power Automate ---

    • Ask for collection passed as a string variable
    • Parse JSON on string variable
    • Initialize variable as array to be used as attachment
    • Apply to each
      •    Compse string(items('Apply_to_each_to_add_photos_to_array')) - Gets each item from JSON parse
      •    Parse JSON on compose ooutput to get each item in string format
      •    Compose on JSON output with Replace() to get first part of file path removed
      •    Get file metadata from above compose
      •     Get metadata from above compose
      •     Append to arrary variable using

     { "Name": @{outputs('Get_file_metadata_using_path')?['body/Name']},
    "File Content": @{body('Get_file_content_using_path')}}

     

    When I get to the send email V2 action and click to add attachments, I am prompted for two variables

     

                                           attach.jpg 

    If I use a single image passed to the flow, then do a metadata and content action on it, I can easily chose Name and Content from the dynamic content from those steps.

     

    All I seem to be able to chose for the array variable is the variable itsel.  I tried putting the array in both attachment variables but that causes the MAPI error.  If I just attach content and name for the single image, the email goes out just fine.

     

    If you can guide me on how to get the images attached to the email, it would be an immense help.  I need to deliver this by Monday morning!

     

  • lmheimendinger Profile Picture
    260 on at

     I found another thing that looks odd when poking more into my testing.

     

    In the Apply to Each loop where it goes through each image in the collection, the Get File Content Using Path looks like this:

     

    lmheimendinger_0-1693068964169.png

     

    Just after the loop, I have the same action but this time for another paramter passed to the flow, a different (business category) of another image.  The output is quite different.  Yes, the libraries are different but quite similar otherwise.  And if I pass only a single image to the flow instead of a collection, the Get File Content step yields a similar output to the one below instead of the one above.

     

    lmheimendinger_1-1693069308908.png

     

    Could this be the cause of the attachment failure, and what can I do about it? The input on the Get File Content steps are exactly the same format, the path to the file, just a different first part of the path to change library.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 339 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 289

#3
Mohsin Ali Profile Picture

Mohsin Ali 228

Last 30 days Overall leaderboard