我正在开发用于记录联系人更改(新添加的更改)的Outlook加载项。我使用以下代码触发Outlook事件。
//触发新的检查器事件
_inspectors = Application.Inspectors;
_inspectors.NewInspector + =新Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
Inspectors_NewInspector事件应该如下
私有无效Inspectors_NewInspector(Outlook.Inspector检查器) {
if (inspector.CurrentItem is Outlook.ContactItem)
{
if (((Outlook.ContactItem)inspector.CurrentItem).EntryID != null)
{
// Here Capture the contact properties changes
}
}
}
以上代码在按完整联系人编辑模式编辑联系人时按预期工作。但是,从2013年和2016年的前景来看,我们可以使用联系人卡片模式编辑联系人。如果我编辑联系人卡片模式,则不会触发NewInspector事件。因此,我无法捕获Outlook联系人的更改。
任何解决此问题的建议。
谢谢。
答案 0 :(得分:1)
您需要订阅Explorer类的SelectionChange事件,该事件在用户以编程方式或通过与用户界面进行交互来选择其他或其他Microsoft Outlook项目时触发。
当用户(通过编程方式或通过用户界面)单击或切换到包含项目的其他文件夹时,也会发生此事件,因为Outlook会自动选择该文件夹中的第一个项目。
您可能会发现How to: Display Selected Items in the Active Explorer文章很有帮助。