0

我想制作一个 Outlook 插件来自动将附件文件制作为 ZIP 文件。现在,我必须获取 TaskItem 以使我发送给其他人的任务邮件只有 ZIP 附件文件。

我已经尝试了以下代码来获取TaskItems。但总是得到我自己发送的TaskItem。我发送给其他人的任务邮件还不是压缩文件。

希望有人可以帮助我。谢谢。

     //the addin start up
     private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        Application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
    }

    //before send the mail
     public void Application_ItemSend(object Item, ref bool Cancel)
    {

        //get  the task items
        var myinspector = Application.ActiveInspector();
        if (myinspector != null)
        {
            //get the TaskItem    
            TaskItem OutlookTaskItem = myinspector.CurrentItem as TaskItem;

            /*

            automatically to make attachment file to ZIP file.

            */


        }

    }
4

1 回答 1

0

如果要获取对正在发送的项目的引用,则必须使用已传递给 Item_Send 事件的 Item 参数。您正在使用 ActiveInspector 引用打开的项目窗口,该窗口可能与正在发送的项目不同。

于 2018-11-30T16:14:26.890 回答