You can use the RibbonID though to narrow it already down. That means,
only send your RibbonX back to Outlook via GetCustomUI for those
RibbonIDs that could be used for your message class.
Then implement getVisible and getEnabled callbacks for your top-level
item (tab or group). When getVisible/getEnabled get called, you get an
IRibbonControl object that has a Context properties. You can use that
Context property to get a handle to the current Inspector and from there
figure out your message class. If it's the right message class, return
true, otherwise return false.
Why getVisible and getEnabled? Ribbon items that are not visible are
nonetheless included in the Options, Customize dialog. So a user could
potentially add any of those not available items to his or her QAT and
then call them when he or she shouldn't be able to call them. Therefore
you need to disable them as well.
You'll have to implement an Outlook event though to invalidate your
top-level control whenever you want to change the two attributes.
Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues:
http://pschmid.net/blog/2006/11/13/80
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007:
http://pschmid.net/office2007/customize
RibbonCustomizer Add-In:
http://pschmid.net/office2007/ribboncustomizer
OneNote 2007:
http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog:
http://pschmid.net/blog/feed