How to Recover from Enterprise Vault

… that moment, when in the cloud – in a real one; i.e.: in a plane somewhere over an ocean – and you eventually got nothing else to do than reading those loads of docs you dropped into your mailbox for later use … that – very – moment … when your enterprise’s archiver kicks in and Outlook tells you it can’t load your eMail as you are – guess what? – OFFLINE!

Here’s what I did.



Enterprise Vault is a great archiving solution. It integrates pretty seamlessly with Outlook. You don’t realize any difference in accessing eMails whether they’re meanwhile archived or not. There’s however a difference: Once Vault has gotten hold of one of your eMails, all you really have in your folders is in essence a torso of 300 chars embedded with a link to the respective Vault item of your eMail.

And now, there’s those occasions when you want to access exactly those old eMails that Vault has long ago grasped; also when offline; and – honestly: PST is not such a bad concept (while I indeed do appreciate companies’ aim to reduce (restrict) PST usage). Anyway. I spent some thought around this recently and ultimately created a solution which works perfectly for me and now lets me access all my old mail again – through a PST folder.

This one’s to explain how that solution works:


The Solution

is a simple Outlook VBA codepiece grabbing any vaulted eMail, opening it and copying it to a respective PST folder. Once opened and copied (the “copy” is key) it loses its vault link and gets its entire content back.


1: Search vaulted eMails

First of all, I defined an Outlook Search Folder to grab all vaulted eMails. This can be done by querying the .MessageClass field:

Vault-blog-1I went by the Search Folder idea as otherwise I’d have to walk through all eMails to find the vaulted ones. BTW: On vaulted eMails the MessageClass field reads “IPM.Note.EnterpriseVault.Shortcut” in its entirety.

2: Folder structure

I then wanted to replicate my folder tree in the target PST – just … well: just ’cause I’m used to. That’s a little recursion:

Function CreateFolder_Recursive(aRootFolder As Outlook.MAPIFolder, aFolder As Outlook.MAPIFolder, bMailOnly As Boolean) _
  As Outlook.MAPIFolder
Dim fldReturn As Outlook.MAPIFolder
Dim itm, itm2 As Object
 For Each itm In aRootFolder.Folders
  If itm.Name = aFolder.Name Then
   Set fldReturn = itm
   For Each itm2 In aFolder.Folders
    Set itm = CreateFolder_Recursive(fldReturn, itm2, bMailOnly)
   Next itm2
   Exit For
  End If
 Next itm
 If fldReturn Is Nothing Then
 ' create the folder only if it is a mailfolder or if the parameter flag indicates that we shall create all folders
  If aFolder.DefaultItemType = olMailItem Or Not bMailOnly Then
   Set fldReturn = aRootFolder.Folders.Add(aFolder.Name)
  End If
  If Not (fldReturn Is Nothing) Then
   For Each itm2 In aFolder.Folders
    Set itm = CreateFolder_Recursive(fldReturn, itm2, bMailOnly)
   Next itm2
  End If
 End If
End Function

3: Get the search folder to retrieve the vaulted eMails from

Finding the respective search folder is just an iteration over all stores and figuring out the SearchFolder object with the right name.

 On Error Resume Next
 Set colStores = Application.Session.Stores
 For Each oStore In colStores
  Set oSearchFolders = oStore.GetSearchFolders
  For Each oFolder In oSearchFolders
   'Debug.Print (oFolder.FolderPath)
   If Right$(oFolder.FolderPath, Len(aFolderName)) = aFolderName Then
    Set FindMySearchFolder = oFolder
   End If


4: Finally – the eMail copy routine

That one’s the major piece of it; with every eMail retrieved from the SearchFolder you got to

  • Open it by the MailItem.Display command; this creates an Inspector object
  • Grab the Application.ActiveInspector and from that the Inspector.CurrentItem
  • Once the MailItem is discovered you can copy it: currentItem.Copy. That’s a major step. You could just right away move the item into the target folder in your PST, but that would not void the vault link.
  • Finally – after that copy operation – you can now move the MailItem in the destined target folder (I made sure it is the same as in the original mail store): MailItem.Move targetFolderName
  • After moving, close the item without changes: MailItem.Close olDiscard

With that operation on any of the vaulted eMails they get freed and accessible without vault connection.


Now – a few useful hints

for the benefit of your patience:

  • The Outlook forms cache is a tricky beast. As Enterprise Vault uses a bunch of custom forms to handle vaulted eMails, the forms cache is heavily used during this operation. I removed it before execution and also made sure that in case it gets scrambled again forms would be loaded from their original source instead to load’em from the cache. Here’s a few sources on the Outlook forms cache and the ForceFormReload registry key.
  • This still did not allow the macro to execute on all the 1300-something eMails I had to unvault. Ultimately, a simple DoEvents command in the macro’s main loop allowed Outlook to regularly recover from its heavy use of the forms cache.
  • Where to start? I used the namespace method PickFolder and simply chose the right folder to target my eMails to by the dialog it throws up.
  • Deletion after unvault: You might wanna consider deleting any vaulted eMail from your main mail store once it’s been copied to the PST.

So, finally the end result now resides within my Outlook Applicaiton as a VBA routine and lets me regularly unvault and PST-archive my eMail.

Nice .. I think.


7 thoughts on “How to Recover from Enterprise Vault

  1. That is good stuff. But, what about all the emails in the Enterprise Vault where i don’t have a shortcut in outlook anymore? How can i automatically copy out the really-old archived emails? Thanks

    1. Only by exploring the Vault’s API as such (and I haven’t gone that far yet, to be honest).
      With my thingy, the custom form cotaining vault-code does most of the job; the VBA is only wrapping itself around. When you cannot use the custom form anymore (as there’s no outlook object) you’ll have to deal with vault interfaces or your administrator 😉

  2. I tried, and it really works nice, however some mails remain open and are not moved. it seems the move command is to quick and out of 13 only 10 are really copied with unvaulted attachment to the other folder the other 3 emails remain open and need manual move from vault to new folder.
    could you share your script details

    1. I had to tweak with breaks in the loop either, indeed. Haven’t used the script in a while and need to dig where I have stored it. Yes, I can gladly share it with you … will come back to this thread.

      1. Hello!

        Did you manage to find the script? I’m in a situation where I have 10,000+ emails stuck in our Enterprise Vault that I need to copy back into a PST file. 🙁

        Thanks in advance!


      2. Sorry, that this took THAT long – I am not very active on my blog these days. Could you just eMail me, please. See about for more details. Thanx

  3. I don’t need to move e-mails with vault shortcuts, but I need to delete them. In my current macro, when I try to delete an e-mail that is a vault shortcut, I get the dialog “You have chosen to delete one or more Enterprise Vault shortcuts”. Of course, I’d like to avoid this dialog, but the bigger problem is that if I choose “Delete Shortcuts” or “Delete Both”, I get an “Application-defined or object-defined error”. If I manually restore the shortcut from the vault before running the macro, the e-mail that is no longer a shortcut will be deleted without issue. I can identify the EV shortcuts by MessageClass = “IPM.Note.EnterpriseVault.Shortcut”, but I don’t know how to handle deleting it. Even if I had to restore it within the macro before deleting it would be OK, but ideally, if I can find a way to delete it without a dialog prompt or an error would be great.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: