DalekSec Posted September 4, 2023 Posted September 4, 2023 Morning All, Dealing with a SARequest at the moment, head of legal wants all the emails in separate PDFs, as currently all in 1 massive PDF. Does anyone know of a free tool to do this? Can only find paid for ones, would rather not go though each email and print manually.. (200+) Thanks Dalek
chaplic Posted September 4, 2023 Posted September 4, 2023 Pop the email in a mailbox then use power automate? Solved: save email as pdf - Power Platform Community (microsoft.com) is roughly whats required, just need to do change trigger 1
GaryPad Posted October 18, 2024 Posted October 18, 2024 Unfortunately Method I saves all the emails into a single PDF file. I think that selecting multiple emails in Outlook and then printing always puts them into a single file. If your email is local, i.e. not in 365, you could look at scripting the MAPI interface but as far as I can tell it will only save to text or HTML so you'd still have to do some sort of conversion, e.g. using Word. Below is a VBScript which if you save it to a file with a .VBS extension, edit it in a plain text editor (like NotePad or better NotePad++) and change the lines which are in bold (or make sure there is a C:\test folder) and also for what exactly to search for in the email subject, it should output to HTML and then get Word to save the email to PDF. Open a command prompt to where you've saved this VBScript and run it with CScript.EXE Set objOutlook = CreateObject("Outlook.Application") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objNamespace = objOutlook.GetNamespace("MAPI") Set objFolder = objNamespace.GetDefaultFolder(6) ' 6 is the Inbox folder Set colItems = objFolder.Items Set colFilteredItems = colItems.Restrict("[subject] = 'My SAR request'") intMessage = 1 strOutputPath = "C:\test\Email " For Each objMessage In colFilteredItems strHTMLFile = strOutputPath & intMessage & ".htm" Set objFile = objFSO.CreateTextFile(strHTMLFile, True) objFile.Write objMessage.HTMLBody objFile.Close Set objWord = CreateObject("Word.Application") objWord.Visible = False Set objDoc = objWord.Documents.Open(strHTMLFile) objDoc.SaveAs2 strOutputPath & intMessage & ".pdf", 17 ' 17 is the constant for wdFormatPDF objDoc.Close False objWord.Quit If objFSO.FileExists(strHTMLFile) Then objFSO.DeleteFile strHTMLFile,True intMessage = intMessage + 1 Next If you want to use a different folder to one of the standard ones, like the InBox, then you change line 5 to: Set objFolder = objNamespace.Folders("[email protected]").Folders("SARs").Folders("Joe Bloggs") Where the first is your email mailbox, the second is sub-folder "SARs", and the third could be another sub-folder for "Joe Bloggs". Hope this helps.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now