Search code examples
c#eventsoutlookinspector

Outlook inspector events not triggered in contact card edit mode


I am developing the outlook add-in for logging the contact changes(what changes added newly). I am used the following code to trigger the outlook events.

//Trigger the new inspector events

_inspectors = Application.Inspectors;

_inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

And the Inspectors_NewInspector events should like follows

private void Inspectors_NewInspector(Outlook.Inspector inspector) {

if (inspector.CurrentItem is Outlook.ContactItem)
{
    if (((Outlook.ContactItem)inspector.CurrentItem).EntryID != null)
    {
        // Here Capture the contact properties changes
    }
}

}

The above code works as expected while editing the contact as full contact editing mode. But, from the outlook 2013 and 2016, we can edit the contact using the contact card mode. If I edit contact card mode, the NewInspector events not getting triggered. So, I am not able to capture the outlook contact changes.

The contact card view as like below. enter image description here

Any suggestion to fix this issue.

Thanks in advance.


Solution

  • You need to subscribe to the SelectionChange event of the Explorer class which is fired when the user selects a different or additional Microsoft Outlook item programmatically or by interacting with the user interface.

    This event also occurs when the user (either programmatically or via the user interface) clicks or switches to a different folder that contains items, because Outlook automatically selects the first item in that folder.

    You may find the How to: Display Selected Items in the Active Explorer article helpful.