
Announcements
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)
I am also attaching the screenshot of expression I wrote for making a collection (Please see attached image).
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
Hi @Anonymous ,
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:
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:
Please take a try with above solution, check if the issue is solved.
Best regards,