Either there is a serious bug in the ContextMenuContactCardRecipient extensibility point, or some kind of refresh/invalidate call is required which I have not been able to find documented anywhere.
Consider the following ribbon XML which adds an item to the context menu that is shown when clicking on a Contact name (e.g. in the From field of a message):
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="CustomRibbonUI_Load">
<contextMenus>
<contextMenu idMso="ContextMenuContactCardRecipient">
<dynamicMenu
id="ContextMenuContactCardDialMenu"
label="Dial Number"
imageMso="DialMenu"
getContent="ContextMenuContactCardDialMenu_GetContent"
invalidateContentOnDrop="true"
/>
</contextMenu>
</contextMenus>
</customUI>
The above works fine, until a message is double-clicked and opened in a new window, then the Inspector is closed. Once the inspector is closed, the customization is ignored for that Explorer window, even when the selection changes (the menu item is displayed
empty and missing the icon). Opening a new Explorer window will allow it to work, again until a message is opened and closed. It also continues to work fine from Inspectors, but not that specific Explorer. I have confirmed this behaviour exists back to Outlook
2013 and attempting to call Invalidate or InvalidateControl on the ribbon (e.g. when an Inspector is closed) has no effect.
This effectively makes the ContextMenuContactCardRecipient extension point useless as the behaviour is unreliable and confusing.
Is there something I'm missing? It's as if Outlook should be re-creating a new IRibbonExtensibility object in this instance, but it's not. The IRibbonExtensibility object does have ComVisible(true) by the way.
I suspect some kind of garbage collection problem (something getting collected or going out of scope which should not be) but I have been able to reproduce it in a very simple solution which does nothing apart from creating the menu item, which makes me
think the bug is in the VSTO libraries...