Forum Discussion
Print a List of Outlook Mail Folders
I know this reply is two years after the original post, but having recently encountered a similar need, I decided to post the related solution. Maybe others searching for this same piece in the future might find this and save themselves some time and frustration.
My need: To take the eMail view within a given folder and copy it to a text file or spreadsheet. No, this does not show the list of folders, but merely the contents of a single selected folder.
My Outlook version is from MS Office Professional Plus 2016, 32-bit. I don't know if this works in earlier versions like 2010 or 2007. (Yes, there are people out there still using their old trusty 2007!)
Steps:
1. For a selected Outlook eMail folder, change the View Settings to display only the columns you wish to copy to your spreadsheet (or other file). There are dozens of fields (column headers) within Outlook that can be displayed. After the desired view has been created, if you'll want to repeat this copy process on other folders, I recommend you save the Current View As to a New View. Going forward you'll be able to quickly select the saved view whenever you need it.
2. Within the Outlook eMail folder, select the eMails you wish to be included in your spreadsheet. CTRL+A to select all, select (highlight) one and then hold the SHIFT key before selecting the last eMail to be included, or hold the CTRL key while individually selecting the desired eMails to be included.
3. Right-click on one of the highlighted emails and choose COPY. This copies the view as text onto the Windows clipboard. If you right-click on a non-highlighted email (or row) you'll lose your selection and you'll have to repeat step #2 again.
4. Open Excel (or other program) and PASTE the copied text. In my case this resulted in a table with the column headers From, To, Subject, Received, Size and the several hundred rows of visible text from within the selected Outlook eMail folder.
Here's a source link where I found some of this info:
https://learn.microsoft.com/en-us/answers/questions/734180/how-to-export-outlook-message-headers-to-excel-as
Hopefully this will help someone in the future.
Should I find a solution to copying the list of folders, I'll come back and share the info.
https://www.howto-outlook.com/howto/exportfoldernames.htm (June, 2021)
For those who would rather not deal with VB code or macros within Outlook, I recommend the first option of downloading a small script file. That way you can just double-click the script file to export the list of Outlook folders.
Visit the above URL to download the exportoutlookfolders.zip file. Save and then unzip it.
Steps to operate:
1. First, have Outlook already opened. Be sure there aren't any dialog boxes open like a notification, an error message, or some other background window from the Outlook program.
2. Double-click the ExportOutlookFolders.vbs file. Outlook will open a Select Folder dialog box (you may need to minimize the File Explorer window to see it) with your default Inbox folder already selected (highlighted).
3. Select the top level from which you wish to export the list of sub-folders and click OK. This may be the mailbox name itself, directly above the already selected Inbox, or a folder down below. If there are multiple eMail accounts configured within Outlook, you'll be able to scroll down to select one of those mailboxes instead. There isn't the ability to select multiple mailboxes at the same time. However, if you run the script again for each additional mailbox, the resulting text will be appended within the outlookfolders.txt file.
NOTE: If you have the outlookfolders.txt file open (locked) when running the script again, you'll encounter a Windows Script Host error that says Permission denied, because the file is locked and cannot be edited. Close that file and run the VBS script again.
4. After clicking OK the Select Folder dialog box goes away and an Output Structuring dialog question (Yes/No) is opened. Like the first dialog box, it does not display at the forefront on top of other existing windows. Look for a new taskbar button called "Output structuring" and click on it to bring the dialog box to the front. I recommend choosing No. Reference the above link to see a few screen captures and the difference of clicking Yes vs No.
5. The script automatically saves the txt file to your Desktop, not the same folder as the script.
Fingers crossed this works well for you.
Enjoy!