仅先打开时才会触发VSTO加载项Outlook约会删除和写入事件 [英] VSTO Addin Outlook Appointment delete and write event fired only if opened first

查看:442
本文介绍了仅先打开时才会触发VSTO加载项Outlook约会删除和写入事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Outlook加载项,如果被删除,我会在其中尝试执行特定操作.我已经打开过的所有约会都可以正常工作.在未先打开约会的情况下创建约会或从日历中删除约会时,不会触发任何事件(BeforeDelete,Write).

I am working on an Outlook Addin where I try to perform a specific action if deleted. It works fine with all the appointments that I have already opened once. When the appointment is created or deleted from the calendar without being open first no event (BeforeDelete, Write) is fired.

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    inspectors = this.Application.Inspectors;
    inspectors.NewInspector +=
    new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
}
void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
{
    appointmentItem = Inspector.CurrentItem as Outlook.AppointmentItem;
    if (appointmentItem != null)
    {
        (appointmentItem as Microsoft.Office.Interop.Outlook.ItemEvents_10_Event).Send += _appointment_Send;
        (appointmentItem as Microsoft.Office.Interop.Outlook.ItemEvents_10_Event).BeforeDelete += _appointment_Delete;
        (appointmentItem as Microsoft.Office.Interop.Outlook.ItemEvents_10_Event).Write += _appointment_Write;    
        (appointmentItem as Microsoft.Office.Interop.Outlook.ItemEvents_10_Event).Open += _appointment_Open;
        (appointmentItem as Microsoft.Office.Interop.Outlook.ItemEvents_10_Event).Close += _appointment_Close;
    }
}

我认为解释是因为只有在约会开放时才附加检查员,并且遵循的路径更像是描述的,但我不确定.除了在删除或创建约会之前未打开约会的特定情况之外,以上代码的工作原理就像一个超级按钮.

I would assume that the explanation lies in the fact inspectors are only attached when the appointment is open and that the path to follow is something more like described here but I am not sure. The above code works like a charm excepted for the specific case where the appointment is not opened before being deleted or created.

任何指导将不胜感激.

推荐答案

是的,BeforeWrite不会触发.如果我在Outlook中选择一个约会,然后使用 OutlookSpy 查看OOM触发的事件(选择约会,单击项目"按钮,转到事件"选项卡,然后查看页面底部的日志,修改内联的约会),我只能看到以下事件触发.

Yes, BeforeWrite does not fire. If I select an appointment in Outlook and look at the events fired by OOM using OutlookSpy (select the appointment, click Item button, go to the Events tab and look at the log at the bottom of the page, modify the appointment inline), I can only see the following events fire.

BeforeDelete.

PropertyChange (ConversationIndex)
PropertyChange (Subject)
PropertyChange (Start)
PropertyChange (StartInStartTimeZone)
PropertyChange (StartUTC)
PropertyChange (End)
PropertyChange (EndInEndTimeZone)
PropertyChange (EndUTC)
PropertyChange (Duration)
PropertyChange (AllDayEvent)
PropertyChange (StartInStartTimeZone)
PropertyChange (StartUTC)
PropertyChange (End)
PropertyChange (EndInEndTimeZone)
PropertyChange (EndUTC)
PropertyChange (Start)
PropertyChange (EndInEndTimeZone)
PropertyChange (EndUTC)
PropertyChange (Duration)
PropertyChange (End)
PropertyChange (MeetingStatus)
Write (false)
BeforeCheckNames (false)
AfterWrite ()
<Unknown(DispID=0x0000FC95)> (false)

这篇关于仅先打开时才会触发VSTO加载项Outlook约会删除和写入事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆