Home How to display and store decrypted mailItem in Outlook
Reply: 0

How to display and store decrypted mailItem in Outlook

user1604
1#
user1604 Published in June 25, 2018, 7:53 am

I am developing an Outlook-AddIn that automatically decrypts emails. So basically, the AddIn changes some MailItem properties (subject, body, attachments) when new mail arrives. The problem is that when I save the item then the decrypted message is synchronized with the server, which is really bad for end-to-end-encryption... If I don't save the item, then the explorer pane still shows the encrypted message and searching for emails (decrypted subject or body) does not work.

My question is: How can I display and (locally) store the decrypted mailItem, so that all the usual features like email searching still work? Is there a way to stop synchronization for specific emails in .ost?

One solution that I came up with is to store a copy of the MailItem in a local .pst store. But in that case the user has to handle the messages in two different stores (.ost and .pst), which is not very user friendly. The requirement is that the user has to change his usual behaviour as little as possible when reading emails.

private void Outlook_NewMailEx(object Item)
    {
        Outlook.MailItem mailItem = Application.Session.GetItemFromID((string)Item);

        if (mailItem != null)
        {
            // decrypt the mailItem
            mailItem.Subject = "decrypted subject";
            mailItem.Body = "decrypted body";

            // save mailItem LOCALLY
            // (don't synchronize the decrypted message with the server)
            mailItem.Save();
        }                    
    }

I would be grateful for any help!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.543949 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO