cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jzhang
Level: Powered On

How to email a collection as attachments?

Hi, I am trying to email some collections as an output of powerapps. In the attachment option, what do I need to specify in the ContentBytes and odata.type fields, if my collection is already a table?  I have seen ways to convert collections of photos and other files into table, but not sure what type I need to specify if it is already a table. 

 

I have got the error message: 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to email a collection as attachments?

Hi @jzhang ,

Do you want to send an emial that contains a table?

1)send a table by using html text

Try this formula:

Office365.SendEmail(
     "email address",
     "subject",
     "<h3>tablename</h3>" &
     "<strong> Items: </strong>" &
     "<table width='100%' border='1' cellpadding='5' style='border:1px solid black; border-collapse:collapse'>" &
     "<tr style='background-color:#efefef'>
      <th>fieldname1</th> <th> fieldname2 </th> <th> fieldname3 </th><th> fieldname4 </th>
     </tr>
     <tr>" &
    Concat('The data source/formula that you provided within the Items property of your Data Table control',
       "<td>" & fieldname1 & " </td>
        <td>" & fieldname2 & " </td>
        <td>" & fieldname3 & " </td>","</tr><tr>") &
    "</table>",
    {
     IsHtml:true
    }
)

Please replace the red part with your data.

Here's my test for your reference:7263.PNG

7264_LI.jpg

7265.PNG

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/Expressions-and-Formulas/Data-Table-to-Email-in-PowerApps/td-p/1...

2)convert a table to an image, send an email with attachment

Try this formula:

Office365.SendEmail(inputTo.Text, inputSubject.Text, inputBody.Text, {Attachments:Table({Name:"file1.jpg", ContentBytes:filevalue, '@odata.type':""})})

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/General-Discussion/Email-with-attachment/m-p/239607

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: How to email a collection as attachments?

Hi @jzhang ,

Do you want to send an emial that contains a table?

1)send a table by using html text

Try this formula:

Office365.SendEmail(
     "email address",
     "subject",
     "<h3>tablename</h3>" &
     "<strong> Items: </strong>" &
     "<table width='100%' border='1' cellpadding='5' style='border:1px solid black; border-collapse:collapse'>" &
     "<tr style='background-color:#efefef'>
      <th>fieldname1</th> <th> fieldname2 </th> <th> fieldname3 </th><th> fieldname4 </th>
     </tr>
     <tr>" &
    Concat('The data source/formula that you provided within the Items property of your Data Table control',
       "<td>" & fieldname1 & " </td>
        <td>" & fieldname2 & " </td>
        <td>" & fieldname3 & " </td>","</tr><tr>") &
    "</table>",
    {
     IsHtml:true
    }
)

Please replace the red part with your data.

Here's my test for your reference:7263.PNG

7264_LI.jpg

7265.PNG

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/Expressions-and-Formulas/Data-Table-to-Email-in-PowerApps/td-p/1...

2)convert a table to an image, send an email with attachment

Try this formula:

Office365.SendEmail(inputTo.Text, inputSubject.Text, inputBody.Text, {Attachments:Table({Name:"file1.jpg", ContentBytes:filevalue, '@odata.type':""})})

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/General-Discussion/Email-with-attachment/m-p/239607

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (7,069)