Full Outlook Archive
Click here for the macro.
This is version 2.1 (January 2009) of my Outlook archive visual basic macro, which was based on my earlier Outlook export to HTML macro, which is retained on this site for reference purposes. This free Macro does the following:
- Automatically Exports all standard Outlook objects (email, contact, calendar entry, read receipt etc) to a user configurable location , proprietory objects (e.g. a special company form) are not supported.
- Retains folder structure (latest version fixes a bug with special characters in folder names).
- Saves Emails as HTML with index number
- Extracts attachments, saves with same index number as the email and adds notification and link to the original email
- NEW FEATURE Saves Calendar entries as both text and .ICS
- NEW FEATURE Saves Contacts as both text and .VCF
- Saves all other objects as text only, with index number
- Extracts any attachments from non-email objects and saves each attachment with the same index number as the object. A Notification is added to the object.
By default the macro will ask you to select the top level folder, but a feature, as can be seen from the script, is the ability for the macro to deal with more than one set of folders (for example you may want to back up an exchange account plus a local PST file or Archive folder, you may also have a series of old PST files you want to back up overnight without having to keep re-running the script).
A point of note; this macro will not work if you have a folder in Outlook called 'Attachments', which is the name of the default folder that attachments are saved in (as a sub-folder of the one which the email etc is saved in), just give any folder with that name a temporary name like 'Attachments1' or the script will do odd things.
About this script/ Macro
As with my earlier script the reasoning behind writing this is to support the archiving of Outlook contents into something that can be viewed on any platform (primarily Linux) and indexed by free off the shelf indexing software (such as Google Desktop, Beagle or Copernic Desktop Search).
How to get the code into Outlook/ Install in Outlook
This is a guide for first time users of VB Editor.
To use copy and paste the code from the linked text file into a new Outlook project. To do this click on 'Tools=> Macro=> Visual Basic Editor'. You can also press 'alt+ F11'.
With the Visual Basic Editor Window open look in the top left hand pane. Open up 'Project1 (VbaProject.OTM)' or whatever the top level Project is called, then open the sub-folder 'Microsoft Office Outlook Objects'. Within that there is a file called 'ThisOutlookSession', open this.
You should now have a blank pane on the right. Paste the code from the text file into this pane and it should render as a Sub Function and a Function.
User Options
Now you have the script in Visual Basic Editor you need to enter your user options. These are entered in the sub function 'StartEmailArchive', which is at the top of the code section; the user options are clearly marked.
Path
This must be an absolute file path (i.e. starting at the C:\\ drive) and point to a real folder that you have created. Ideally this should be an empty folder as the script will by default overwrite files with no warning.
StartTheFolder
This refers to the top level folder as seen in your left hand outlook pane. By default it will ask you to select a folder. Just change the title in the last set of brackets in line with the examples for example 'Mailbox - Users Name' for an Exchange Server.
Running the Macro
Save the Macro and close the VB editor. Back in Outlook click on 'Tools=> Macro=> Macros' or 'alt+F8' and you will see the one Macro called either 'ThisOutlookSession.StartEMailArchive' or just 'StartEmailArchive'. Select it and click 'Run'. You may have to edit Macro security settings to allow the Macro to run.
The Macro gives no error messages, no status update, and it will reduce Outlook to a quivering wreck whilst it runs; so depending on how full your Outlook folders are you may be waiting a long time. You can either go to lunch, or for a little entertainment go to the folder you entered as 'Path', you should see a slowly growing folder list, and within each folder a growing number of HTML and text files. If you don't see this then something went wrong (e.g. folder path incorrect), check that you entered your user options correctly. For serious errors please contact me.