How to test Type of Office.IRibbonControl control "Context"

May 19, 2015 at 11:14 PM
Edited May 19, 2015 at 11:15 PM
Hi everybody,

I'm having the following VSTO Code working:
if (control.Context is Outlook.Explorer)
    return getMailItem(control.Context as Outlook.Explorer);
As control.Context only contain the COM Object this is of course not working with netOffice.

So the question is do we have ways to test for the COM Type or do we have to brute force Cast to find out? Might be overkill but I like to test object type before Casting them especially in outlook where events like selection change could return several type of objects.

Thanks in advance for the feedback
Do we have some