08-13-2012 11:57 AM
Hi everyone,
I would like to write an Outlook add-in in C# that is able to detect if a given email is stored in exchange or in enterprise vault. Is there some way I can detect the difference from my add-in code?
This should be possible since outlook and EV plugin know where each email is, so they must be tagged in some way.
Thanks for your help!!! Please let me know if further information or clarifications are needed.
Carlos
Solved! Go to Solution.
08-14-2012 03:24 AM
08-13-2012 12:15 PM
If by "a given email is stored in exchange or in enterprise vault" you mean if it's a shortcut or not, the message class will be that of a shortcut (IPM.note.enterprisevault.shortcut) otherwise it'll be something else.
08-13-2012 12:22 PM
Hi AndrewB, thanks for your answer.
So if the message class is IPM.note.enterprisevault.shortcut I will be certain that it is an EV shortcut? great!
Quick question, where can I find documentation about that? How did you find out this?
Thanks
08-13-2012 12:42 PM
if you look at the properties of the message in outlook you'll be able to see what the message class is. you can also sort your mailbox by message class and see that all of the EV shortcuts are different from your other types of messages.
08-13-2012 12:42 PM
For example, within the context of the code below, the mailItem a System._ComObject - how would I determine it's class, and wether it is a IPM.note.enterprisevault.shortcut object?
Outlook.MAPIFolder inbox = this.application.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
dynamic mailItem = inbox.Items.GetFirst(); //how get class of mailItem to detect Enterprise vault?
Thanks
08-13-2012 12:53 PM
the best i can do is give you the theoretical information since i'm not a developer. perhaps someone else on the forum knows how to code what you're asking for.
08-13-2012 12:58 PM
Not really sure whether we should be going in to coding.
But honestly its going to be like Andrew said, use IPM.Note.EnterpriseVault*
other than that, break out outlook spy and look at the different mapi properties EV stamps on any given message
Anywho:
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._mailitem.messageclass.aspx
08-13-2012 01:00 PM
Great, thanks for the answers - I'll give it a try and update.
08-13-2012 01:04 PM
Don't go writing an Enterprise Vault add-in and putting me out of a job! ;) That said, I'll look at writing up a simple C# application and putting the example code on my personal site if you would like?
08-13-2012 01:11 PM
Hi Ben,
That would be great! My intention is to have both EV add-in and my own add-in so don't worry about your job :)
Thanks!
08-13-2012 01:42 PM
To clarify, what I want to do, is on the startup of my add-in, do something like the following
Foreach email in Inbox
if IsEnterpriseVaultShortcut(email) then
//do something
else
//do something else
and the question is how to implement the IsEnterpriseVaultShortcut routine in a C# outlook add in
08-13-2012 11:21 PM
It is worth remembering that if you use this model, then you will hit :
http://msdn.microsoft.com/en-us/library/office/aa210946(v=office.11).aspx
A 'security' pop-up if/when you access particular properties:
You receive the confirmation dialog box when a solution tries to programmatically access the following properties of the MaiItem object:
Also on that same page is a reference to the MessageClass property... which is what you are after to determine if an EMAIL is a shortcut or not...
http://msdn.microsoft.com/en-us/library/office/aa171490(v=office.11).aspx
Remember though that not all items are turned in to shortcuts after archiving - like calendar items, tasks and so on.
08-13-2012 11:23 PM
Hi reply too soon.. because of the security dialog, you could look in to something like the Redemption library. There is an example of it's use here by me:
http://www.symantec.com/connect/downloads/contacts-checker-enterprise-vault
08-14-2012 03:24 AM
08-14-2012 05:38 AM
Hi Ben, thanks for the effort of writing the code! great article by the way, I'm sure it will help other people as well.
Rob, thank you very much for the clarifications.
I'll give it a try and mark as answered so other people can use the question as reference.
08-14-2012 06:02 AM
Which version of Outlook are you using 2003, 2007 or 2010?
08-14-2012 06:10 AM
Do you think this will work in both EV 9 and EV 10?
08-14-2012 06:27 AM
It will work with any version of EV.
Like rob said though, you can use Redemption and the SafeMailItem to avoid any security warnings/pop ups.
Only thing to note though is that it is possible to have items archived by EV that aren't a shortcut.
So for instance if you have a policy that says dont create shortcut, don't delete the original item, it will be archived and exist in the users archive and the item in the mailbox is left seemingly untouched but EV does add properties so that it doesn't keep getting re-archived
08-14-2012 06:27 AM
Do you mean my sample code? Sure, no reason why it shouldn't work accross all versions, our custom message class hasn't changed in ages.
08-14-2012 06:54 AM
You're welcome.