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 / Passing attachments on...
Power Apps
Answered

Passing attachments on to an email

(0) ShareShare
ReportReport
Posted on by 72

Attachments are being collected from an attachment control by setting the OnSelect property of a button to

 

ClearCollect(AttachCollect,ForAll(DataCardValue12.Attachments As Document,{contentBytes: Document.Value,name: Document.Name}))

 

Things seem to be working fine up to this point; Gallery_Attachments displays the content of the collection correctly (both Name and ContentBytes):

 

Salv_0-1659475345260.png

 

Now I am trying to pass the same information from the AttachCollect collection on to an email; I've set the OnSelect property of the Send Email button to Office365Outlook.SendEmail(_varToField, TextEmailSubject2.Text, TextEmailMessage2.Text,{Attachments:Table(AttachCollect)}), but I am getting this error:

 

Salv_1-1659475829503.png

 What am I doing wrong?

 

Categories:
I have the same question (0)
  • Tetris Profile Picture
    72 on at

    Forgot to add that _varToField in the Send Email button code is a variable that collects email addresses from another table and that the error is given by the {Attachments:Table(AttachCollect)} of the code. Thanks!

  • WarrenBelz Profile Picture
    156,275 Most Valuable Professional on at

    Hi @Salv ,

    This blog of mine sets out sending attachments by email.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Tetris Profile Picture
    72 on at

    Thank you! Will check it out

  • Tetris Profile Picture
    72 on at

    Clever! Great blog,

     

    However, I'm kinda looking for the inverse process: select all my files from a library > get them into a gallery (which I did successfully) > transfer them to an attachment control.

     

    I'm not even sure whether that is possible at all... but it'd work perfectly for my solution...

  • Tetris Profile Picture
    72 on at

    ... and, of course... get everything into an email...

  • Verified answer
    WarrenBelz Profile Picture
    156,275 Most Valuable Professional on at

    Hi @Salv ,

    Firstly, if you do this - assuming all the attachments are unsaved

    ClearCollect(
     AttachCollect,
     AddColumns(
     RenameColumns(
     DataCardValue12.Attachments,
     "Value",
     "ContentBytes"
     ),
     "@odata.type",
     ""
     )
    )

    You should be able to send this

    Office365Outlook.SendEmailV2(
     _varToField, 
     TextEmailSubject2.Text, 
     TextEmailMessage2.Text,
     {Attachments: AttachCollect}
    )

    With regard to your second question  - collecting a Library does not retrieve the actual file content (you get the file name and URL and some Thumbnail information which can be resolved in an Image control). 

    It could be done with Power Automate with a fair bit of complexity getting all the item content in a filter you send then parsing all of that into an array, but it is not something I have needed to attempt (a single attachment however is quite easy).

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Tetris Profile Picture
    72 on at

    Thank you @WarrenBelz. Works like a dream!

     

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 421 Most Valuable Professional

#2
11manish Profile Picture

11manish 153 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 116 Super User 2026 Season 2

Last 30 days Overall leaderboard