Power Community

Power Community

Email PDF of screen without (and with) a Flow

A short blog from a post I answered that may be helpful. The need to send a screenshot (it could be a form, invoice or anything else) as an email attachment straight from Power Apps is highly useful.
The process actually is very simple using the PDF() function. Firstly, a temporary variable needs to be created with the file content and that used to form the email attachment. This one is to the user, but could be to any address.

With(
   {wPDF: PDF(ScreenName)},
   Office365Outlook.SendEmailV2(
      User().Email,
      "Subject here",
	  "Body here",
      {
         Attachments: 
        {
            Name: "PDFFileName.pdf",
            ContentBytes: wPDF
        }
     }
  )
)

Note also you can send the same content to a Flow, but need to convert it to Base64

With(
   {
      wPDF: PDF(ScreenName),
      wJSON: 
      With(
         {
            wJSONI: 
            JSON(
               wPDF,
               JSONFormat.IncludeBinaryData
            )
         },
         Mid(
            wJSONI,
            Find(
               ",",
               wJSONI
            ) + 1,
            Len(wJSONI) - 
            Find(
               ",",
               wJSONI
            ) - 1
         )
      )
   },
   AttachFileFlow.Run(
      wJSON,
      User().Email,
      "Test Subject",
      "Test Body",
      "TestFile.pdf",
   )
)

then do the normal base64ToBinary in the Flow

AttachPDFFlow.png

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img
- Advertisement - Advertisement

Latest News

SharePoint Roadmap Pitstop: November 2022

Gobble, gobble - time to gobble up all the updates that landed for SharePoint and related tech in the...

More Articles Like This

- Advertisement -spot_img