cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Qwertworks
New Member

save email as pdf

Let us save an email as PDF document when using outlook.com or 365.

 

For example I would like to set up a flow that lets me archive all emails that come are put into a certain folder as PDFs to my OneDrive. From what I see this does not seem to be possible as of right now.

35 REPLIES 35

Is there a way to have either the PDF (or preferably) the .eml or .msg format of the outlook mail be printed/attached as a page in a section of OneNote? Storage on the OneDrive folder is good, but even better would for my workflow would be to have each e-mail be printed/pasted into its own page within a section of a OneNote notebook.

Hi @teqs

 

I agree there should be standard action from Microsoft. Find my response to your questions below:

  • I had tested Inline images and also images hosted public, ConvertAPI endpoint was able to convert. PDF was created with the images as expected
  • For 1 PDF with 2 images, it took around 10 seconds
  • For higher or lower compressions, I've not tested it. There are different parameters you can pass on the API endpoint. Check it on the ConvertAPI website.

Again I am not advocating the ConvertAPI, I've just found the free plan thought of consuming it on Flow. You can also host the API in Azure for converting email to PDF with some C# code, there are opensource PDF libraries (PDFSharp, iTextSharp etc) available. 

I am trying to convert the time stamped on the converted email section "Sent On" . I was able to convert from UTC to my time zone (using the convert time zone connector after the "When a new email arrives" trigger) which i used for the PDF name but i'm curious if there is a way to convert and paste the updated time on the actual PDF. Any thoughts?

 

For example.. here is the time stamp listed on the converted email. It states it came in at 2:16 pm UTC but i need it to be listed as 8:16 am MT. 

aramirez_3_0-1597164889821.png

 

Thank you !

Hi @v-xida-msft ,

 

quick question, our company has an email retention policy of one (1) year, My question: is possible to add a date range or select time period to save all the email under the selected timeframe?

 

I would like for instance have saved all my emails from July. Or even better at the end of July 31st @ 11:59 pm will trigger my flow and start backing up my email from July 1st until July 31st and automatically saving all PDF's in my one drive?

 

Make sense?

 

Thank you kindly for any response

Gitesh_Bajaj
New Member

It helped Perfectly...

Thank You for your Help

camerond01
New Member

There might be a work around without resorting to external APIs. I tried converting to HTML instead of PDF to see if embedded images would come up correctly. My flow also saves all attachments, and treated those embedded images as attachments and saved them, which was unexpected but helpful. Looking at the HTML the part where the embedded images are has what looks like a temporary path created during the conversion process. Mine looked like src="C:\SandboxTempLow\as987df6asd876f87asd678f6as89\email_content\image001.png". When I removed the path from the src bit and just had src="image001.png" the HTML file showed the embedded image correctly when open in a web browser.

Perhaps the flow can edit the HTML file and replace the offending src string with the right one and hey presto HTML files show embedded images? Will see how it goes, hope this helps anyone else scratching their heads.

@camerond01Sounds great that you have a possible solution! I quit by trying it for a time by myself. 😞
It would be perfect if you could share your full flow when it works with different emails. Here is also a topic where your solution would be extremely interesting for people: : 

https://powerusers.microsoft.com/t5/Flow-Ideas/Export-Mail-to-PDF-format-or-convert-eml-file-to-PDF-...

The flow starts about the same as the accepted solution, but with a parallel workflow to also save each attachment:

 

camerond01_0-1637546242490.png

 

From there it gets messy:

 

camerond01_1-1637546340979.png

 

I had to escape the backslashes in the HTML source, changing "C:\blah\blah\" to "C:\\blah\\blah\\". For each email attachment looks like this:

 

camerond01_2-1637546464529.png

 

camerond01_3-1637546499637.png

That's right, we're calling a Javascript function inside an Excel spreadsheet residing on OneDrive from a Flow. Because Flow's don't have regex built in, and I guess that MS don't want to cannibalise serverless functions revenue. Got the idea from here: How to use Regex in Power Automate (tachytelic.net)

 

Except nothing ever works the first time and I had to write a test harness to work out the bit with escaping the backslashes. Out of an abundance of caution I concat'd the attachment name into the variables being passed. Javascript is as per the above link.

 

If something like this comes up again I'm going to stand up an API endpoint on my public facing server and just make calls to that and deal with everything at my end and send back results, because quite frankly this is a ridiculous solution to a stupid problem. I mean yeah it works, but at what cost.

Anonymous
Not applicable

has anyone had issues with this flow with external email address, gmail or not office 365 accounts? is there a solution? 

jaxonanthony021
Helper II
Helper II

Users can read this blog to save Outlook email as PDF. This blog has explained the two types of solutions, manual and professional methods. Both methods are helpful and perform successfully. So read the blog carefully and get these solutions. 

jaxonanthony021
Helper II
Helper II

If you want to save Outlook emails as PDF, read this article. It has explained the best techniques via manual and automated methods. All the methods are very efficient to perform. But many non-technical users may not perform the manual approach. So they can go with the professional method.

teqs
Kudo Commander
Kudo Commander

Built-in solution to convert Emails to PDF stops working because "Convert file", which is used to convert to PDF, is not accepting "*.eml" anymore. It delivers an error message.

 

 

{
  "status": 406,
  "message": "Conversion of this file to PDF is not supported. (Sandbox_BadArgument_ArgumentNull / An exception occurred while executing within the Sandbox)",
  "source": "api.connectorp.svc.ms"
}

 

 

I tried to simply change the exported email from *.eml to *.html, but with *.html the conversion of email with "Convert file" is not working well. It does not identify the email header and display it correctly anymore.

Is there any currently working solution to export incoming emails to PDF with built-in Power Automate nodes?

 

@v-xida-msft: I see you are "Community Support" and posted the solution ( https://powerusers.microsoft.com/t5/Building-Flows/save-email-as-pdf/m-p/109222/highlight/true#M1071... )

Would be very nice if you could communicate with MS that your posted solution is working again. As I described, "Convert file" is not able to convert EML to PDF anymore. Thank you!

 

elizabds
Regular Visitor

This accepted solution works for me and the explanation about the final deletion step was helpful too. I changed 'Received time' to 'subject' since it works better for our team. I've been troubleshooting and LOOKING for this solution for a while. Great forum. Thank you!!

teqs
Kudo Commander
Kudo Commander

Hello @elizabds

 I hope you don't mind me asking a quick question. As in the accepted solution, you did a "Create File" of the incoming email-body to a *.eml-file. And from this "Create File" you placed the ID (result) into the "Convert File" as input?


This had not worked for me in the last weeks anymore, because "Convert File" threw an Error ("Conversion of this file to PDF is not supported") with a *.eml file. If this now works again, I will try to change it again next week. Just want to be sure it's the same solution.

Thanks a lot!

teqs
Kudo Commander
Kudo Commander

I tested today, and as @elizabds said already, the Email->*.eml->*.pdf workflow is working again. Still same problems as before, no images as example, but I do not get an error anymore when the "Convert file" input is named with extension *.eml.
Perhaps it's related to email content, i don't know. Or MS has fixed the isssue I postetd 3 posts before.
Anyway, seems to work fine again. Thanks!

Ok, so just to be clear, there's currently no way to do this via the built in actions? Like other said, i can get the eml > pdf conversion, but it doesn't export the images with it.

Helpful resources

Announcements

Power Platform Connections - Episode 7 | March 30, 2023

Episode Seven of Power Platform Connections sees David Warner and Hugo Bernier talk to Microsoft MVP Dian Taylor, alongside the latest news, product reviews, and community blogs.     Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show!      Show schedule in this episode:    0:00 Cold Open 00:30 Show Intro 01:02 Dian Taylor Interview 18:03 Blogs & Articles 26:55 Outro & Bloopers    Check out the blogs and articles featured in this week’s episode:    https://francomusso.com/create-a-drag-and-drop-experience-to-upload-case-attachments @crmbizcoach https://www.youtube.com/watch?v=G3522H834Ro​/  @pranavkhuranauk https://github.com/pnp/powerapps-designtoolkit/tree/main/materialdesign%20components @MMe2K​ https://2die4it.com/2023/03/27/populate-a-dynamic-microsoft-word-template-in-power-automate-flow/ @StefanS365 https://d365goddess.com/viva-sales-administrator-settings/ @D365Goddess https://marketplace.visualstudio.com/items?itemName=megel.mme2k-powerapps-helper#Visualize_Dataverse_Environments @MMe2K    Action requested:  Feel free to provide feedback on how we can make our community more inclusive and diverse.    This episode premiered live on our YouTube at 12pm PST on Thursday 30th March 2023.    Video series available at Power Platform Community YouTube channel.    Upcoming events:  Business Applications Launch – April 4th – Free and Virtual! M365 Conference - May 1-5th - Las Vegas Power Apps Developers Summit – May 19-20th - London European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas    Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community    If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.       

Announcing | Super Users - 2023 Season 1

Super Users – 2023 Season 1    We are excited to kick off the Power Users Super User Program for 2023 - Season 1.  The Power Platform Super Users have done an amazing job in keeping the Power Platform communities helpful, accurate and responsive. We would like to send these amazing folks a big THANK YOU for their efforts.      Super User Season 1 | Contributions July 1, 2022 – December 31, 2022  Super User Season 2 | Contributions January 1, 2023 – June 30, 2023    Curious what a Super User is? Super Users are especially active community members who are eager to help others with their community questions. There are 2 Super User seasons in a year, and we monitor the community for new potential Super Users at the end of each season. Super Users are recognized in the community with both a rank name and icon next to their username, and a seasonal badge on their profile.  Power Apps  Power Automate  Power Virtual Agents  Power Pages  Pstork1*  Pstork1*  Pstork1*  OliverRodrigues  BCBuizer  Expiscornovus*  Expiscornovus*  ragavanrajan  AhmedSalih  grantjenkins  renatoromao    Mira_Ghaly*  Mira_Ghaly*      Sundeep_Malik*  Sundeep_Malik*      SudeepGhatakNZ*  SudeepGhatakNZ*      StretchFredrik*  StretchFredrik*      365-Assist*  365-Assist*      cha_cha  ekarim2020      timl  Hardesh15      iAm_ManCat  annajhaveri      SebS  Rhiassuring      LaurensM  abm      TheRobRush  Ankesh_49      WiZey  lbendlin      Nogueira1306  Kaif_Siddique      victorcp  RobElliott      dpoggemann  srduval      SBax  CFernandes      Roverandom  schwibach      Akser  CraigStewart      PowerRanger  MichaelAnnis      subsguts  David_MA      EricRegnier  edgonzales      zmansuri  GeorgiosG      ChrisPiasecki  ryule      AmDev  fchopo      phipps0218  tom_riha      theapurva  takolota     Akash17  momlo     BCLS776  Shuvam-rpa     rampprakash  ScottShearer     Rusk  ChristianAbata     cchannon  Koen5     a33ik  Heartholme     AaronKnox  okeks      Matren   David_MA     Alex_10        Jeff_Thorpe        poweractivate        Ramole        DianaBirkelbach        DavidZoon        AJ_Z        PriyankaGeethik        BrianS        StalinPonnusamy        HamidBee        CNT        Anonymous_Hippo        Anchov        KeithAtherton        alaabitar        Tolu_Victor        KRider        sperry1625        IPC_ahaas      zuurg    rubin_boer   cwebb365   Dorrinda   G1124   Gabibalaban   Manan-Malhotra   jcfDaniel   WarrenBelz   Waegemma   drrickryp   GuidoPreite    If an * is at the end of a user's name this means they are a Multi Super User, in more than one community. Please note this is not the final list, as we are pending a few acceptances.  Once they are received the list will be updated. 

Register now for the Business Applications Launch Event | Tuesday, April 4, 2023

Join us for an in-depth look into the latest updates across Microsoft Dynamics 365 and Microsoft Power Platform that are helping businesses overcome their biggest challenges today.   Find out about new features, capabilities, and best practices for connecting data to deliver exceptional customer experiences, collaborating, and creating using AI-powered capabilities, driving productivity with automation—and building towards future growth with today’s leading technology.   Microsoft leaders and experts will guide you through the full 2023 release wave 1 and how these advancements will help you: Expand visibility, reduce time, and enhance creativity in your departments and teams with unified, AI-powered capabilities.Empower your employees to focus on revenue-generating tasks while automating repetitive tasks.Connect people, data, and processes across your organization with modern collaboration tools.Innovate without limits using the latest in low-code development, including new GPT-powered capabilities.    Click Here to Register Today!    

Check out the new Power Platform Communities Front Door Experience!

We are excited to share the ‘Power Platform Communities Front Door’ experience with you!   Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well.   Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities.     Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform.      Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.

Microsoft Power Platform Conference | Registration Open | Oct. 3-5 2023

We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida.   Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more.   Register today: https://www.powerplatformconf.com/   

Users online (1,912)