cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
roby9390
Helper II
Helper II

Error on sending email - Parameter 'attachment content' cannot be null or empty

Hi all,

I'm having trouble sending emails with multiple attachments through my app.

The error encountered is the following:

error.png

The OnSelect property of my send icon is:

Office365Outlook.SendEmailV2(
    txtDestinatari.Text;
    txtOggetto.Text;
    txtCorpoMailAirFlash;
    {
        Importance: "Normal";
        Cc: txtCopiaConoscenza.Text;
        Bcc: txtCopiaConoscenzaNascosta.Text;
        Attachments: RenameColumns(
            AllegatiMailAir.Attachments;
            "Value";
            "ContentBytes"
        )
    }
);;
Reset(txtCopiaConoscenza);;
Reset(txtDestinatari);;
Reset(txtOggetto);;
Reset(txtCopiaConoscenzaNascosta);;
Back();;
Notify(
    "Richiesta inviata con successo!";
    NotificationType.Success;;
    3000
)

I state that the attachments are correctly imported into the mail sending screen. (see screenshot below)

roby9390_0-1669624311940.png

 

5 REPLIES 5
v-jefferni
Community Support
Community Support

Hi @roby9390 ,

 

Could you please share more details about your scenario? I tried to reproduce this issue but failed. How large are the two PDF files? Have you tried to use small jpg files and test?

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

@v-jefferni  Thank you for your reply.

The PDF files are large respectively 13Kb and 21Kb.

I think it's not size the issue.

Hi @roby9390 ,

 

Sorry but I still cannot reproduce this error. Could you please double check the outputs of the table below, by selecting this whole function in the formula bar after files have been uploaded?

RenameColumns(
            AllegatiMailAir.Attachments;
            "Value";
            "ContentBytes"
        )

 

So, if you have uploaded two files, there should be two records return by this function, and no blank contentBytes column value be there.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni 

here below the screenshot where you can see that the 2 records appear correctly in the table.

Cattura.JPG

 

But I think I have omitted something quite important: my Items property of my attachment control is setting as follow:

varRecord.attachments

varRecord is set by pressing an icon contained in a gallery which has the following properties:

Set(varRecord;ThisItem);;Navigate(Schermo_MailAereaFlash;Fade)

In the mail sending screen, the attachments are correctly shown in the appropriate control but it generates the error as if the control were empty. If I delete the automatically uploaded attachments and reload them manually directly from the attachment control on the send mail screen, the problem does not occur and the mail is sent correctly.

 

Let me know if I wasn't clear on anything.

Hi @roby9390 ,

 

You can see that the content bytes will contain values from different formats, as distinct from getting saved files in SharePoint lists and manually uploading files:

vjefferni_0-1669972853189.png

 

If you will only send emails with files saved in SharePoint list Attachments column, you need to leverage a flow the get the files from specific list, by passing the selected item ID from PowerApps to Power Automate, then use "Get items" action with filter query set to ID eq "Ask in PowerApps" dynamic content. Next, you can "Get attachments" from that item and get attachment contents, send Email with , as in below blog:

Power Automate send an email with an attachment from SharePoint - EnjoySharePoint

 

Also, you can reference below video:

www.youtube.com

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,329)