![]() If you are running Windows OS, this software can be considered a superb desktop product to extract data in your Outlook account. How to Save an Outlook Email as a PDF on Windows ![]() Here in this post, we’ll talk about how to quickly save an Outlook email as a PDF for archival purposes. To save an Outlook email as a PDF is not always easy. There may be a potential question: how to save an email as a PDF? For some crucial messages, users may want to keep them locally rather than online, giving rise to the need to convert email to PDF. Please note, that I've no experience with Outlook and used MSDN to get relevant properties for object, so the code might need some tweaking.Emails are still an essential means of communication today. $ret = $Email.HTMLBody | & $ExePath '-', $OutFile) 2>&1 $OutFile = Join-Path -Path 'c:\path\to\emails' -ChildPath ($Email.Subject + '.pdf') Here is an example: # Get path to wkhtmltopdf.exe Use HTMLBody property of MailItem object in your script for PDF conversion.It has no external dependencies and can be redistributed with your script, so you don't have to install PDF printer on all PCs. Install or extract installer with 7Zip and copy wkhtmltopdf.exe to your script directory.Get precompiled binary (use MinGW 32-bit for maximum compatibility).Looks like there are no built-in methods, but if you're willing to use third-party binary, wkhtmltopdf can be used. ![]() $BaseFolder += $Outlook_Folder_Path + "\" $Outlook_Folder_Path = ($Folder.FullFolderPath).Split("\",4) $Connection = $Outlook.GetNamespace("MAPI") I loop through $Emails $Outlook = New-Object -comobject outlook.application Here is the base of the code to get the emails. Short of saving all of the emails to a temp file and using a third party method is there parameters I can pass to PrintOut? Or another way to accomplish this? I am using the com object of outlook.application. I looked on the MSDN page and it was a bit to high for my current level. I haven't been able to figure out what to pass to it to have it automatically save to a specific filename. ![]() I found the PrintOut method in object, but that prompts for a file name. This works wonders, but now management has requested the email itself be saved as a PDF as well. I am using PowerShell to loop through designated folders in Outlook and saving the attachments in a tree like structure. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |