Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
Answered

Passing collection in Office365.SendMail Attachment Fail

(0) ShareShare
ReportReport
Posted on by

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

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    on at
    Re: Passing collection in Office365.SendMail Attachment Fail

    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: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,

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Microsoft Dataverse

#1
stampcoin Profile Picture

stampcoin 17

#2
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 9 Super User 2025 Season 1

Overall leaderboard

Featured topics