Forum Discussion

jamesstjohn's avatar
jamesstjohn
Copper Contributor
Aug 23, 2022

Print a List of Outlook Mail Folders

My boss has an extensive list of folders in his Outlook - literally hundreds of folders he saves his emails to. I am trying to come up with a leaner approach to his email hording and would like to have a list of all the folders so I can attempt to reorganize and provide some project guidelines for how he approaches saving his emails. I know this is not a function built into outlook, and I have researched it and most answers require an understanding of coding which I am not versed in. Does anyone know how to accomplish this, by whatever methodology (except typing out the list), even if coding is involved (so long as it's easy to understand)? Thank you!

  • 4dgeorge's avatar
    4dgeorge
    Copper Contributor

    jamesstjohn 

    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.

      • 4dgeorge's avatar
        4dgeorge
        Copper Contributor
        Thanks for the very quick response! I'll save those for future reference.
    • 4dgeorge's avatar
      4dgeorge
      Copper Contributor
      Here's a solution for exporting Outlook's folders and sub-folders to a text list:
      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!
  • Victor_Ivanidze's avatar
    Victor_Ivanidze
    Bronze Contributor

    Expand all their folders and make several screenshots. Then combine the screenshots in any graphical editor to get the whole picture (it will be really big I guess),

    • jamesstjohn's avatar
      jamesstjohn
      Copper Contributor
      I tired this method as well but Adobe would transpose the screen shots into viable text. I will attempt with other apps that can manage the same function.
  • jamesstjohn,

     

    I am an independent advisor responding to this inquiry.

     

    I found two great articles with VBA codes to run a macro to print your list of Outlook Folders with | without item count. 

     

    https://www.extendoffice.com/documents/outlook/4099-outlook-print-list-of-folders.html

     

    And, @diane_poremsky of SlipStick System has a good article as well.

    https://www.slipstick.com/developer/print-list-of-outlook-folders/

     

    If you find this information helpful, please mark it as the best answer or like it, which will help others with the same question.

     

    And, wishing with you well with your project. 

     

    /Teresa

    #traccreations4e

     

    • jeancarlton's avatar
      jeancarlton
      Copper Contributor

      Teresa_Cyrus This tip works like a gem. Just made sure to change the Trust Center setting for Macros as mentioned. 

       

      Thank You!

    • jamesstjohn's avatar
      jamesstjohn
      Copper Contributor

      Teresa_Cyrus - thanks for the articles! I tried this, but I keep getting an error saying VBA compile error - Invalid Outside Procedure. I assume the people who wrote the code checked it, so it can't be bad coding. Would this have anything to do with maybe our network email and the parameters don't take this into consideration, that the code is written for single users NOT using not on networked email? I am not at all versed in this and am merely spit balling, but if you have other ideas I am all ears! Thank you!

      • >>
        I keep getting an error saying VBA compile error - Invalid Outside Procedure
        <<
        Did you copy the entire macro or miss a line or two at the end? That will cause the error. Did it highlight any of the lines?

        Did you paste it in to ThisOutlookSession or into a new module? It should work in either, but pasting it in a module is recommended, especially if you have other macros.


Resources