次の方法で共有


Office 2010 Development – Outlook main window ribbon ID

I’m currently writing an Outlook add-in and I’m looking into getting this compatible with both Office 2007 and Office 2010. One of the new features in Outlook 2010 is the main window Ribbon.

Using VSTO, you can create your own Ribbon, which can be automatically merged with default Ribbons by setting the correct OfficeId property for your Ribbon. Office 2007 has the list of available OfficeId values available here, but I has some trouble locating a list for the Office 2010 Technical Preview.

After some trial and error, I figures out there’s an easy way to find out what the different IDs for a specific Ribbon and it’s tabs is.

Office 2010 let’s users customize the Ribbon from within Office.

 

outlook_2010_ribbon_001

Clicking ‘Customize the Ribbon’ brings up the customization dialog:

outlook_2010_ribbon_002

On the right-hand side of the dialog, right-click the ‘RSS’ tab within the expanded ‘Home’ tab and choose ‘Rename’. Name it e.g. ‘testRSS’. After customizing, press OK on the dialog and re-open the customization dialog once more (if you don’t close and re-open the dialog, the following steps will not lead to the desired result).

Now press the ‘Import/Export’ button and select ‘Export all Ribbon and Quick Access Toolbar customizations’. Save the file.

 

outlook_2010_ribbon_003

The exported Office UI file has a .exportedUI extension. Rename this to .xml and open up the file. You’ll see something like this:

<mso:cmd app="MSOutlook" dt="0" />

<mso:customUI xmlns:mso="https://schemas.microsoft.com/office/2007/10/customui">

<mso:ribbon>

<mso:qat/>

<mso:tabs>

<mso:tab idQ="mso:TabMail">

<mso:group idQ="mso:GroupRss" label="testRSS"/>

</mso:tab>

</mso:tabs>

</mso:ribbon>

</mso:customUI>

Note the ‘TabMail’ ID. This is the current (it’s a technical preview, things will probably change in the future) identifier for the Ribbon Tab you’ve just modified.

OK, we’ve got the Tab OfficeID. However, for a Ribbon to show up, you also need to specify RibbonType property. Normally, using VSTO, you get a drop down with all possible values for this property within Visual Studio. However, the main window Ribbon in Outlook is new, so there’s no value for this Ribbon within the list. Luckily, you can also type in your own value. Now all that’s left is finding out the name of the main Ribbon and we’d be set.

I looked around, but the value for the main Ribbon was a mystery to me. Finally, I decided Outlook probably had the string in memory during runtime, so I could use Process Explorer to find the correct value. As you probably know, Process Explorer has a tab called ‘strings’ on the properties dialog of a process. This tab enumerates all strings within the image of the process and lists them here.

outlook_2010_ribbon_004

I searched for ‘Microsoft.Outlook.’ (all values in the regular drop down start with this) and found ‘Microsoft.Outlook.Explorer’. Searching further, the other values we all know and love came up. However, ‘Microsoft.Outlook.Explorer’ was the only truly new value.

outlook_2010_ribbon_005outlook_2010_ribbon_006

I tried using this value for the RibbonType and low and behold, my add-in appeared on the ‘RSS’ tab of the main Ribbon.

Key take-away: Using a RibbonType of ‘Microsoft.Outlook.Explorer’ and ‘TabMail’ as your ControlId, you can place your add-in on the main ribbon of the Outlook window.

UPDATE: in Visual Studio 2010 beta 2, you can just select the RibbonType mentioned ;-)

Disclaimer: This has been tested on the Technical Preview of Office 2010. There are no guarantees whether these IDs will be stable as we move forward with the product.

Comments

  • Anonymous
    August 28, 2013
    Two thumbs up. It works like a charm...