idQ
is the right way to go. This attribute allows you specify a qualified id, i.e. an id within a namespace. Some namespaces such as mso
are built in, but custom namespaces can also be specified.
The key is that you need a xmlns:foo="bar"
attribute in your customUI
element that matches the namespace declared within the customUI
of the 3rd party add-in you are trying to extend.
For example, suppose I have the XML for the following 3rd party add-in:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mso:customUI xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui"
xmlns:foo="bar">
<mso:ribbon>
<mso:tabs>
<mso:tab idQ="foo:someTab" label="an extensible custom tab">
<mso:group id="someGroup" label="a custom group">
<mso:button id="someButton" label="button" />
</mso:group>
</mso:tab>
</mso:tabs>
</mso:ribbon>
</mso:customUI>
Now, I want to extend the existing foo:someTab
with a new group in another add-in or template. I define a customUI
in the new add-in, making sure to specify the same namespace attribute in the customUI
element. I then reference the existing tab using idQ="foo:someTab"
:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mso:customUI xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui"
xmlns:foo="bar">
<mso:ribbon>
<mso:tabs>
<mso:tab idQ="foo:someTab" label="an extensible custom tab">
<mso:group id="someOtherGroup" label="a different custom group">
<mso:button id="someOtherButton" label="a different button" />
</mso:group>
</mso:tab>
</mso:tabs>
</mso:ribbon>
</mso:customUI>
This results two groups on a single custom tab. The same approach can be used to extend groups and other container controls.
I learned this through careful study of the Office 2010 Ribbon UI XSD. Unfortunately, it's poorly documented outside of the XSD itself.