I have an Outlook addin for encryption and decryption that supports Outlook 2010 to 2013.
I am trying encrypt email to decrypt and display.
I am using open mail through mailItem_Open function
wrappedMailItem.Open += new MailItemInspectorOpenDelegate(mailItem_Open);
through this function i just decrypt email and content updated using
mailItem.HTMLBody = decryptString
Then the inspector window open and showing decrypt mail. Its working fine. I close the inspector window
mailItem_close function call
void mailItem_Close(Outlook.MailItem mailItem, ref bool Cancel)
{
try
{
if (mailItem == null)
return;
if (mailItem.Sent != false)
{
var signProperty = GetProperty(mailItem, "App.Decrypted");
// NOTE: Cannot call mailItem.Close from Close event handler
// instead we will start a timer and call it after we
// return. There is a small race condition, but 250
// milliseconds should be enough even on slow machines.
if ((bool)signProperty)
{
var timer = new System.Windows.Forms.Timer { Interval = 250};
timer.Tick += new EventHandler((o, e) =>
{
timer.Stop();
((Outlook._MailItem)mailItem).Close(Outlook.OlInspectorClose.olDiscard);
mailItem = null;
});
Cancel = true;
timer.Start();
}
}
}
catch
{
// Ignore random COM errors
}
Marshal.ReleaseComObject(mailItem);
}
The issue is
But am not closing the inspector window (Showing decrypt message) i just click the forward button its open new inspector window by out look and forward email and close it. Then i close the inspector window ,but the parent mailItem (Ie. inbox mail) showing in decrypt mode . In mailItem_close function i just discard all changes but its not working
This issue is not happening in Reply procedure in same steps, only happens forward case
Please help me