Save and backup Outlook accounts and items (emails, appointments, attachments etc.) onto local drive.
In my Outlook only the last three months of emails are available offline, the rest are archived and moved into my Online Archive - Name@Company.com account. Even when connected to the network the archived account only shows the first 200 odd characters of an email body and no attachments are available. This means that Outlook search won’t find anything from the archived account.
My solution to this problem is to save all emails from all accounts onto my desktop where I can perform search in Windows Explorer: search within emails body and in attachments.
SaveOutlookEmails saves accounts from Outlook onto a desktop folder.
- Keep offline emails up-to-date date: autorun SaveOutlookEmails when Outlook starts (at start of Outlook Enable Macros when prompted with 'Microsoft Office has identified potential security concerns.')
- Save archived accounts: run SaveOutlookEmails on selected folder (will take a while, run it at lunch time or at night, see more under Warnings)
Outlook's folder structure is kept the same and files are named with date-time prefix and shortened subject.
- Outlook folders are validated against
Invalid_Folders
while Outlook items againstValid_Items
. - Date and subject are checked whether the item has been saved before, if not then email validity checked in details.
- When
OLItem.MessageClass
ends with any words defined inArchived_Array
(in my case ends with 'EAS', my email archive client, if it is different in your cases updateArchived_Array
in Config) emails will be opened and then saved to get the full body and attachments. - Size and number of recipients are limited (see Config).
- Outlook folder names and email subjects are cleaned for invalid characters.
- Subject dynamically shortened to fit into full path limit (255 characters on Windows).
- All successfully saved emails are added to Log.txt
- When auto run SaveOutlookEmails items on local drive are checked using
fso.FileExists
. When the number of already saved emails reachesOverlap_Resaved
and the timeframe of already saved emails is overOverlap_Days
then scanning emails will stop. Autorun won’t open emails as recent items are part of the offline Outlook database, including attachments. - When manually run on selected folders 'file exists' check is based on the Log file. This check is a simple loop though the log array. After an email has been found then the next loop will start from where the previous has been found to shorten the loop time.
- Configuration file is saved at
C:\Users\{Your-Name}\SaveOutlookEmails.txt
where the backup location can be updated (e.g.C:\Users\{Your-Name}\OneDrive - {Company-Name}\eMails
); default locationC:\Users\{Your-Name}\Desktop\eMails
. - It has been tested on Windows 7 and Windows 10, Outlook 2013 and Outlook 2016 versions.
- Add Developer ribbon
- Check Macro Settings in Trust Canter
- Add Microsoft Scripting Runtime in VBA editor
- Copy code files from Code or SaveOutlookEmails Ver1.10.zip
Note: if your IT system blocks the use of bas
files, then:
- Download a copy of the AllInText Ver1.10.zip
- Drag and drop
BackBar.frm
andBackupBar.frx
- Copy the content of
AllInText.txt
- Create a new module: in VBA editor
[Menu bar\ Insert\ Module]
- Paste the code there
- Add auto run code to ThisOutlookSession
- Add Quick Access icon
- Hide Developer ribbon
- To save archived emails with full body and attachments, they must be opened and then saved. This will happen automatically causing the screen to flicker and limit the use of the computer.
- If connection is slow or IT limits access, then SaveOutlookEmails will throw a run-time error: Click on 'End', restart Outlook and try to run SaveOutlookEmails again later.
- I am dyslexic therefore spelling mistakes are likely within the code.
- Not fully 'DRY', there is room for improvement.
- Maximum email size:
Max_Item_Size = 25000000
25MB - Maximum number of recipients:
Max_Item_To = 250
- Invalid characters:
* / \ : ? " % < > |
,line feed
,carriage return
andhorizontal tabulation
- Overlap days:
Overlap_Days = 7
- Overlap number:
Overlap_Resaved = 100
- Overlap subject:
Overlap_Subject = 20
is used to left-compare email subject and file name - Default folder on desktop:
Defult_Folder = "Desktop\eMails"