Ben Heymink

Software Developer - Javascript/Angular/node/C++/C#/MAPI/Outlook

Simple C# Outlook Add in

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!

 

9 Comments

  1. When did you create this?! Pretty neat!

  2. Hey Ben,

    thanks for sharing this – I am wondering if its possible with an addin to pull emails out of the EV archive, in other words to unvault it.
    Is there any chance to do this with a custom addin like the one you created here?

    Thanks!
    Max

    • admin

      August 13, 2013 at 7:18 am

      Hi Max. It’s possible, although there is no public, supported client API from Enterprise Vault to do this. Through careful inspection of the web traffic the Enterprise Vault client add-in sends to the Enterprise Vault server you could reverse engineer the steps needed to restore an item, but it’s a lot of work!

      If it’s every item you want to restore, take a look at this:
      https://github.com/benheymink/CCBuilder

      Whats the reason for a separate add-in to the Enterprise Vault add-in?

  3. Hey Ben,

    we created an addin to store emails and documents on SharePoint – it streamlines the workflow and enables the users to share knowledge – w/o additional mails.

    Too bad there is no public API – I would use a private/unsupported api, too…. I will see what Fiddler tells me 😉 Thanks for the pointer!

    So long!
    Max

    • admin

      August 14, 2013 at 9:38 am

      It gets a bit more complex I’m afraid. The client add-in modifies/adds some MAPI properties of the item before calling the EV server to archive/restore the item from Exchange. EV does have a public API for Insertion/Retrieval, but it’s not really suited for doing it from within Outlook. See the section on the Content Management API here:
      http://www.symantec.com/business/support/index?page=content&id=TECH71291

      • Hey Ben,

        changing MAPI properties should not be very complex – we use Redemption for E-Mail decryption, so the properties should be easy to change.

        Is the approach for restore:

        1. Modify the mapi properties of the email to restore
        2. Send a http request to the EV server
        3. wait until restore

        Thank you so much!
        Max

        • admin

          August 15, 2013 at 9:05 am

          Yep, that’s pretty much what you have to do. I can’t condone doing it, nor is it in any way supported – it could change at any time!

          The item gets marked as a pending restore and timestamped if I remember correctly. Then, a call is made to EV, and the client waits for the item to be restored to the mailbox.

          Again, I can’t emphasize enough; this is all internals, and NOT supported, I work for Symantec, but anything I say here are my own thoughts, yada yada…

          That said, good luck!

          • Thanks Ben – maybe I do an unsupported blog post about my experience!
            No worries, not claiming any responsibility here – just trying to solve the problem not make a new one 😉

          • Hi Ben,

            i tried to restore the mails – but I am stuck.

            What I did so far:

            1. Set the mail MessageClass to “IPM.Note.EnterpriseVault.Shortcut.RestoreMe”;
            2. I do a http call to the enterprise vault webservice (got it from fiddler) – with http 20 0 as result.

            Now I expect the mail to be replaced – but only the icon changed. Do you know if there is another property to set?

            Thanks!
            Max

Leave a Reply

Your email address will not be published.

*

© 2017 Ben Heymink

Theme by Anders NorenUp ↑