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

Passing collection in Office365.SendMail Attachment Fail

Hi PowerUsers,

 
I am having this issue while passing collection as an attachment.


I am trying to send multiple attchments (Through CDS attachements) in Email thourgh Office 365 SendMail function.
When attaching collection in Attachment section of  send email function i am receving an Error. (Find Attched Image)

Blob_error.png

I am also attaching the screenshot of expression I wrote for making a collection (Please see attached image).

Screenshot_1.png
I have followed this tutorial for sending multiple attachments, still no Luck.
https://www.youtube.com/watch?v=V3feURQfY3M

I am hoping for a swift response. 

Regards,
Ali Nawaz

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Passing collection in Office365.SendMail Attachment Fail

Hi @Ali_Nawaz ,

Based on the formula you used to create the Collection, I think there is something wrong with it.

 

The result the DataCardValue4_1.Name formula and DataCardValue4_1.Value formula returns is a Table value rather than a single text value. But within the Attachments property of the Office365.SendEmail() function, the Name property is required to provide a text value.

 

I have made a test on my side, please take a try with the following workaround:9.JPG

 

10.JPG

Set the OnSelect property of the "Collect" button to following:

ClearCollect(
             AttachCollect,
             ForAll(
                    RenameColumns(DataCardValue9.Attachments,"Name","Name1", "Value", "Value1"),
                    {
                       Name: Name1,
                       ContentBytes: Value1,
                       '@odata.type': ""
                   }
               )
)

On your side, you should collect your Attachments files into a Collection using the following formula:

ClearCollect(                /* <-- Modify your formula here */
             AttachCollect,
             ForAll(
                    RenameColumns(DataCardValue4_1.Attachments, "Name", "Name1", "Value", "Value1"),
                    {
                       Name: Name1,
                       ContentBytes: Value1,
                       '@odata.type': ""
                   }
               )
)

then set the OnSelect property of the "Send Email" button to following:

Office365.SendEmailV2(
"Test1@xxxxxx.onmicrosoft.com",
"PowerApps Test",
"PowerApps Test Email",
{Attachments: AttachCollect}
)

On your side, you should modify your Office 365 SendMail as below:

Office365.SendEmailV2(
                       "Your EMail Address", 
                       "Subject", 
                       "EMail Body",
                       {
Attachments: AttachCollect,
IsHtml: true,
Importance: "Normal"
} )

The attachment files would be sent well as below:11.JPG

Please take a try with above solution, check if the issue is solved.

 

Best regards,

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

Re: Passing collection in Office365.SendMail Attachment Fail

Hi @Ali_Nawaz ,

Based on the formula you used to create the Collection, I think there is something wrong with it.

 

The result the DataCardValue4_1.Name formula and DataCardValue4_1.Value formula returns is a Table value rather than a single text value. But within the Attachments property of the Office365.SendEmail() function, the Name property is required to provide a text value.

 

I have made a test on my side, please take a try with the following workaround:9.JPG

 

10.JPG

Set the OnSelect property of the "Collect" button to following:

ClearCollect(
             AttachCollect,
             ForAll(
                    RenameColumns(DataCardValue9.Attachments,"Name","Name1", "Value", "Value1"),
                    {
                       Name: Name1,
                       ContentBytes: Value1,
                       '@odata.type': ""
                   }
               )
)

On your side, you should collect your Attachments files into a Collection using the following formula:

ClearCollect(                /* <-- Modify your formula here */
             AttachCollect,
             ForAll(
                    RenameColumns(DataCardValue4_1.Attachments, "Name", "Name1", "Value", "Value1"),
                    {
                       Name: Name1,
                       ContentBytes: Value1,
                       '@odata.type': ""
                   }
               )
)

then set the OnSelect property of the "Send Email" button to following:

Office365.SendEmailV2(
"Test1@xxxxxx.onmicrosoft.com",
"PowerApps Test",
"PowerApps Test Email",
{Attachments: AttachCollect}
)

On your side, you should modify your Office 365 SendMail as below:

Office365.SendEmailV2(
                       "Your EMail Address", 
                       "Subject", 
                       "EMail Body",
                       {
Attachments: AttachCollect,
IsHtml: true,
Importance: "Normal"
} )

The attachment files would be sent well as below:11.JPG

Please take a try with above solution, check if the issue is solved.

 

Best regards,

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

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 145 members 3,676 guests
Please welcome our newest community members: