简体   繁体   English

Outlook插件转发问题

[英]Outlook addin forward issue

I have an Outlook addin for encryption and decryption that supports Outlook 2010 to 2013. 我有一个用于加密和解密的Outlook插件,支持Outlook 2010至2013。

I am trying encrypt email to decrypt and display. 我正在尝试加密电子邮件以解密和显示。

I am using open mail through mailItem_Open function 我正在通过mailItem_Open函数使用开放邮件

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 mailItem_close函数调用

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 . 然后,我关闭检查器窗口,但是父mailItem(即收件箱邮件)以解密模式显示。 In mailItem_close function i just discard all changes but its not working 在mailItem_close函数中,我只是放弃所有更改,但不起作用

This issue is not happening in Reply procedure in same steps, only happens forward case 在同一步骤的“答复”过程中不会发生此问题,仅向前发生

Please help me 请帮我

与其动态修改消息的内容,不如创建自己的表单以显示解密的数据,而不设置原始消息并可能将其保存在原始消息中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM