Ribbon question

J

John Erickson

Hi,

I'm trying to repurpose some of the controls on the mail inspector ribbon.
Are the ribbon controls available in the Office::_CommandBars collection? If
so, under which control are they located? I've looked in the most obvious
one. The one called "Ribbon", but at the time the NewInspector event triggers
I only see one control listed under that collection. Are they added after the
NewInspector event? If so, when is the ideal time to look for them?

John
 
K

Ken Slovak - [MVP - Outlook]

The ribbon controls are not in the CommandBars collection. You need to use
the XML schema for Outlook to know what XML to write for your ribbon
controls and to handle built-in controls in the ribbon. You then set up
callbacks for the things exposed by the schema and make all of your
customizations that way.

You can download the ribbon schemas from the Office developer Web site.
There are also samples there for how to use the ribbon.
 
J

John Erickson

Is there one document that I can download that describes all the idMso
commands in the Outlook ribbons or is there a utility like Spy for Ribbons?
 
K

Ken Slovak - [MVP - Outlook]

The ribbon schemas is a zip that has general docs on the overall ribbon
schema, then there are individual docs for each Office application's schemas
and individual ones for each Outlook item type. Everything isn't in just one
doc.

One way to get an idMso for a built-in ribbon control is to go to the
customize dialog for the QAT. In there if you hover over a control the idMso
will be displayed. I do that every so often in one-off situations, but I
find it more efficient when I'm composing a complete ribbon XML to work with
the separate docs.
 
J

John Erickson

Thanks Ken! I was able to use the hover technique to get the idMso values
that I need to repurpose. I think I am having issues with the xml format
though. I wish IRibbonExtensibility::GetCustomUI was designed differently so
that it was able to return an error code on poorly formatted xml and give me
some clues as to what's wrong. Since this is only my second attempt at
submitting xml for this call (Jenson Harris' example in using RibbonX with
C++ and ATL being my first), perhaps you can take a quick look at the xml I'm
providing and tell me what I'm doing wrong. The reason I think I'm having XML
issues is that I never see a call to my IDispatch::GetIDsOfNames when I click
the appropriate button. Here's the XML I'm returning:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
<ribbon>
<commands>
<command idMso="JunkEmailAddToBlockedSendersList" onAction="OnABSL">
<command idMso="JunkEmailAddToSafeSendersList" onAction="OnASSL">
<command idMso="JunkEmailAddToSafeDomainList" onAction="OnASDL">
<command idMso="JunkEmailOptions" onAction="OnOptions">
<command idMso="JunkEmailMarkAsNotJunk" onAction="OnMarkAsNotJunk">
</commands>
</ribbon>
</customUI>

John
 
K

Ken Slovak - [MVP - Outlook]

There is a setting in the Tools, Options advanced tab to show UI ribbon
errors that can sometimes be helpful, at least to localizing the error to
the XML line.

I'd have to get back to you on your repurposing XML, I only played with that
a little and it was a few years ago.
 
J

John Erickson

Thanks again Ken. That allowed me to track down the problems. I had to
eliminate the ribbon tags and terminate the command tags with a \>. After
that it worked great.
 

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