This project has moved and is read-only. For the latest updates, please go here.

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

May 20, 2015 at 12:14 AM
Edited May 20, 2015 at 12:15 AM
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