Application.ActiveInspector() is Null on Ribbon Load

D

Deepak N

Is it possible to access the ActiveInspector at the time of ribbon load. Application.ActiveInspector() return proper value when i use custom form but not working for default contact form.

Actually i want to customize ribbon button depending on a property value in ActiveInspector().CurrentItem.
Submitted using http://www.outlookforums.com
 
K

Ken Slovak - [MVP - Outlook]

Customize the ribbon in what way?

The callback for ribbon XML is made only on the first opening of that type
of Outlook item. So the first time a contact is opened the ribbon callback
is called and you return the XML for a contact item ribbon.

What I'd do would be to handle the Inspector.Activate() event. In the first
Activate() event I'd make a ribbon.Invalidate() call, where ribbon is an
object variable for your IRibbonUI instance.

The Invalidate() call will fire any callbacks you have set up in the XML for
visible and enabled, among other things. You can use those callbacks to get
the ActiveInspector().CurrentItem and read its properties, then decide which
ribbon UI you want to show/hide/enable/disable.

If you have dynamic controls such as a dynamicMenu you can also populate the
control as desired at that point from those callbacks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top