web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sending PDF and images...
Power Apps
Unanswered

Sending PDF and images to email

(0) ShareShare
ReportReport
Posted on by 7

I have made a form to report certain event.

The output of this report has be in PDF format. In this form I have an attachment control where people can upload there documents/images. I can send an email for the attachments and for de the PDF. However, I can not combine both codes.

Has anyone a solution to solve this problem?

 

Convoi123_0-1699105989746.png

 

Categories:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    on at

    HI , @Convoi123 

    According to your description, you want to use the "Office365Outlook.SendEmailV2" to send pdf and image from the attachment control and add image control. Here are the steps you can refer to :
    (1)This is my control in my app:

    vyueyunmsft_0-1699234519531.png

    (2)We can use this code in the Button-Onselect:

    ClearCollect(attaches,{Name:AddMediaButton1.FileName,
    ContentBytes: AddMediaButton1.Media, '@odata.type':""} 
    );
    Collect(attaches,AddColumns( RenameColumns( Attach.Attachments ,"Value", "ContentBytes") ,"@odata.type","") 
    );
    Office365Outlook.SendEmailV2("AniyaZhang@xxxxxxxxxx.onmicrosoft.com","email with attachment" , "here is your picture",{Attachments:attaches});

     

    (3)The result is as follows:

    vyueyunmsft_1-1699234575806.png

    And we need to keep the Attachments parameter is a table type with the columns:
    "Name","ContentBytes","@odata.type"

     

     

     

    If I misunderstand what you mean, you can describe your needs and your expected outcomes in detail so that we can better help you.


    Best Regards,

    Yueyun Zhang

     

     

  • Convoi123 Profile Picture
    7 on at

    Hi Yueyun,

     

    thanks for you comment. I will explain my problem better.

    The picture that I showed above was my test environment. Below you can find the code that I am using for my original application. I generate a PDF to show the answers what the user had filled in.

     

    Set(varPDFongevallen;PDF('NL conPDFongevallen';
    {
    Orientation:PaperOrientation.Portrait;
    Size:PaperSize.A4;
    Margin:"20px";
    ExpandContainers: true;
    DPI:96
    }))

    &
    Office365Outlook.SendEmailV2("email";"Subject";
    "Body"
    ;
    {
    Attachments: Table(
    {
    ContentBytes: varPDFongevallen;
    Name: "Incidentmelding.pdf"
    }
    )
    }
    )

     I want to add in a code because in my application I have an opportunity for the user to add images and other documents using an attachment controlConvoi123_0-1699261059150.png . When I add the code below it does not work in combination with attachment I have already for my PDF. Seperatly the codes work.

    {Attachments: AddColumns(RenameColumns(Fotos1BijnaOngeval_6.Attachments; "Value"; "ContentBytes");"@odata.type";"")}

     So, what could be a solution to send the generated PDF and the attachments that the users add in the attachments control to the email?

     

    thanks in advance

  • Verified answer
    v-yueyun-msft Profile Picture
    on at

    Hi , @Convoi123 

    I test it in my side , it works good with this code :

    Set(varPDFongevallen,PDF(Screen1,
    {
    Size:PaperSize.A4,
    Margin:"20px",
    ExpandContainers: true,
    DPI:96} )) ;
    
    ClearCollect(MyAttach3, {Name:"pdfText.pdf",ContentBytes: varPDFongevallen , '@odata.type':""});
    Collect(MyAttach3, AddColumns( RenameColumns( Attach.Attachments ,"Value", "ContentBytes") ,"@odata.type","") );
    
    Office365Outlook.SendEmailV2("AniyaZhang@Mxxxxxxxicrosoft.com","email with attachment" , "here is your picture",{Attachments:MyAttach3});

    vyueyunmsft_1-1699263345435.png

     

    The result is as follows:

    vyueyunmsft_0-1699263319599.png

     

     

     

    Best Regards,

    Yueyun Zhang

  • Convoi123 Profile Picture
    7 on at

    Hi Yuenyun,

     

    thanks for the reply. It still does not work for me. I am doing something wrong?

    What is 'MyAttach3'? Is it a controller in your example?

    Below my code that I used.

     

    Set(varPDFongevallen;PDF('NL ConPDFongevallen;
    {
    Size:PaperSize.A4;
    Margin:"20px";
    ExpandContainers: true;
    DPI:96}))

    &

    ClearCollect(MyAttach3;{Name:"pdfText.pdf"; ContentBytes:varPDFongevallen; "@odata.type";""}) &
    Collect(MyAttach3; AddColumns(RenameColumns(Fotos1BijnaOngval.Attachments ;"Value"; "ContentBytes") ;"@odata.type";"") ) &

    Office365Outlook.SendEmailV2("email";"email with attachment" ; "here is your picture";{Attachments:MyAttach3})

     

    Convoi123_0-1699273192518.png

     

    Thanks in advance for your reply again!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard