Save Outlook mailitem body as PDF

outlook vba save email as pdf
convert msg to pdf c#
vba code to convert outlook email to pdf
outlook vba - save email to folder
convert msg to pdf vba
code to convert msg to pdf
outlook vba print to pdf
outlook 2016 save as pdf missing

I'm working with Outlook and C# and my school exercise is to convert the body of an email in pdf without using extra software. In my case I would like to keep the email text format so to solve my problem I've considered to convert the email body in a RTF file, then open this RTF file with the Word application by C# and save it as PDF.

I would like to know how to obtain a RTF file from an MailItem. I've found on the web that it is possible to convert the MailItem body in RTF format using the BodyFormat property but i don't get how to create then a RTF.

Should be as simple as:

MailItem.BodyFormat = OlBodyFormat.olFormatRichText;
MailItem.SaveAs("FilePath", OlSaveAsType.olRTF)

MailItem.BodyFormat Property:

MailItem.SaveAs Method:

Save Outlook Email as a PDF, How to use VBA to save selected Outlook messages as PDF files. As Selection Dim obj As Object Dim Item As MailItem Dim wrdApp As Word. HTMLBody If CheckHTML = False Then ConvertHTML = False Else If� There are two ways to save Outlook messages in PDF format: by printing to a PDF printer or saving in PDF format from Word. This sample shows how to use the Word Object Model to save as PDF. (There is a third way: use Adobe Acrobat's package feature. It makes a really nice PDF archive, if you own Acrobat.)

The answer provided by @JoshH is good. In fact it helped me, but the only thing is that it doesn't include the embedded files present in the email body like images. If you want to do that, set the body format to HTML instead of 'FormatRichText':

MailItem.BodyFormat = OlBodyFormat.olFormatHTML;
MailItem.SaveAs("FilePath", OlSaveAsType.olRTF)

That being said, the code I provided doesn't include the attachments made to the email itself, that is, not in the body.

I hope this helps someone.

Save e-mail messages or entire folders as pdf-file, Looking for a way to save a message directly as a pdf-file? The VBA macro from this guide adds this option to Outlook without the need to install anything� Save Selected Emails In PDF: Select the message/s you want to save as PDF and right click on it, click on 'Convert to Adobe PDF'. Now provide a name to save the PDF file in the system and click on 'Save', the respective Outlook messages will be saved in PDF format along with embedded attachment.

You can do without saving file as rtf format.

            Outlook.MailItem mi = selection[1] as Outlook.MailItem;               
            mi.BodyFormat = Outlook.OlBodyFormat.olFormatRichText;
            string fullPath = Path.Combine("SaveLocation", mi.Subject + ".pdf");
            //mi.SaveAs(fullPath, Outlook.OlSaveAsType.olRTF);                
            Word.Document doc = mi.GetInspector.WordEditor;
            doc.SaveAs2(fullPath, FileFormat: Word.WdSaveFormat.wdFormatPDF);

use using Word = Microsoft.Office.Interop.Word; in header

How to Quickly Export Part of an Outlook Email as a PDF File, Subsequently, copy and paste the following VBA code into this module. Sub ExportSelectionAsPDF() Dim objMail As Outlook.MailItem Dim objMailDocument As� If you are working in Windows 10, your Microsoft Outlook provides a printer of Microsoft Print to PDF. With this feature, you can quickly save an email to PDF file at ease. 1. Select or open the email you will export to PDF file, and click File > Print. 2.

How to save email as pdf file in Outlook?, With the following article, you will easily save email as pdf file in Outlook. Save email as pdf file in Dim MySelectedItem As MailItem. Dim Response As String. Using a macro, we know how to selectively create a pdf version of the Outlook message to specific network folders. This is currently a manual process involving the selection of a single message to save as pdf, and then selecting the network folder.

MailItem.SaveAs method (Outlook), Saves the Microsoft Outlook item to the specified path and in the format of the specified file type. If the file type is not specified, the MSG format� In the appearing “File” menu, turn to “Export” tab. Then, choose “PDF” in the “Select Format” list. Lastly, click “Export” button. Then, in the new popup window, select a Windows folder and enter a name for this PDF file. After click “OK”, you will get a new PDF of calendar successfully. Keep Your Outlook Data Well-protected

Converting MSG to PDF programmatically, BTW, in below code why are you not saving directly to pdf instead of HTML format ? Is there Another way is to print MailItem.Body[^] by Note that Body returns a string representation of clear-text body of the Outlook item. Nope there is no direct way in Outlook at least to save as pdf. Also printing doesn't accept arguments so I cant use a pdf to file printer driver. I guess I could create a PDF but the metadata found on the MSG files will probably be lost.