Microsoft Outlook自动化:捕获Save事件

时间:2013-03-22 14:47:43

标签: c# events outlook office-interop

我需要在outlook(2010)中捕获任务的保存,但taskItem或检查员似乎都没有这样的事件。所以我设置了捕获检查员关闭:

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    inspectors = this.Application.Inspectors;
    inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
}

private void Inspectors_NewInspector(Outlook.Inspector inspector)
{
    Outlook.TaskItem taskItem = inspector.CurrentItem as Outlook.TaskItem;
    if (taskItem != null)
    {
        if (taskItem.EntryID == null)
        {
            ((Outlook.ItemEvents_10_Event)taskItem).Close += new Outlook.ItemEvents_10_CloseEventHandler(Task_Close);
        }
    }
}

如果我关闭检查器,则会调用事件处理程序,但是如果单击“保存并关闭”则不会。 底线是我需要在用户保存任务时捕获(这样我就可以对主题进行处理。)是否有可以使用的事件来捕获“保存并关闭”按钮?

1 个答案:

答案 0 :(得分:1)

而不是定义“Outlook.TaskItem taskItem;”在本地,通过全局可见性在顶部定义。