There was a question posted on the Symantec Connect forums the other day where someone was asking for some example code to enumerate items within Outlook and determine if they were Exchange mail items or items that have been archived by Enterprise Vault.
The code to do this is pretty simple actually, we can use the Outlook Object Model to navigate through folders accessing items and from there it is simply a case of having a peek at the PR_MESSAGE_CLASS property of the item and checking to see if it matches ‘IPM.Note.EnterpriseVault.Shortcut’.
To develop this code, you’ll need to set up a computer for Microsoft Office Development by following the steps listed here. Once you’ve done that, fire up Visual Studio, create a new project, and select the ‘Outlook 2010 Add-in’ (or 2007 add-in) template under the ‘Office’ section of Visual C’ project templates:
Name it something useful, then hit OK. Once the project has loaded, you’ll want to replace the contents of the template-provided file ‘ThisAddIn.cs’ with my code, which you can get from here.
After replacing the code, hit F5. This will build the soloution and add some registry keys that Outlook reads to load your add-in. To get rid of it, Right-click on the solution root and select ‘Clean Solution’.
That’s it! Simples!