Outlook 2016 AttachmentRemove does not fire



在我的Outlook Addin中,我订阅了MailItemAttachmentRemoveAttachmentAdd

在Outlook 2016中,添加事件将被激发,而删除事件未被激发。Outlook 2013两者都有效。订阅和取消订阅两个事件的时间和方式相同。我确信没有收集到任何会阻止引发事件的对象。


编辑(版本信息(

Office版本:

  • Microsoft Outlook 2016 MSO(16.0.13801.20240(32位2102(Build 13801.20294点击运行(
  • Microsoft Outlook 2016(16.0.5113.1000(MSO(13.0.5122.1000(32位

安装office的两个系统都是64位系统。


编辑(代码剪切(

public CommonItemInternal(object item)
{
if (item == null)
return;
this.UniqueId = GetUniqueId(item);
commonItemLookup.Add(this.UniqueId, this);
this.Item = item;
if (this.Item is MailItem)
{
var mailItem = this.Item as MailItem;
mailItem.PropertyChange += this.COM_CommonItemInternal_PropertyChange;
mailItem.AttachmentRemove += this.COM_mailItem_AttachmentRemove; // <-- Does not get called
mailItem.AttachmentAdd += this.COM_mailItem_AttachmentAdd; // <-- Get called
}
}

首先,确保在全局范围内声明源对象-垃圾收集器不会将其从堆中清除。第二,尝试保存项目。在将光标切换到另一个字段或保存项目之前,Outlook对象模型可能不会对UI更改做出反应。第三,不清楚使用什么代码来处理AttachmentRemove事件。我建议张贴所有的代码或只是可复制的最小样本代码。

最新更新