Published
Friday, September 15, 2006 8:48 AM
by
martin
In the xml for a Ribbon extension, you can give each control an ID, which is just a simple textual string that uniquely identifies the control within that extension. You can refer to those IDs in order to position other controls before or after, etc.
How can you refer to a control ID that's not defined in your add-in? Well, if the control you want to name is a built-in Office control, you can use the idMso attribute, but if you want to identify a control that's come from another add-in you need something different. This is where qualified IDs come in. Here's an example...
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
xmlns:mns="OutlookAddIn1"
onLoad="OnLoad" >
<ribbon>
<tabs>
<tab id="MyTab" label="My Tab">
<group id="MyGroup" label="My Group">
<button idQ="mns:button1"
size="large" label="normal button"
onAction="OnButtonClicked" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
The idQ attribute defines the qualified ID for the button control, and the namespace part of that qualified ID is defined higher up in the root element. Here's the important bit: you can't use just any old name for your namespace. In this example I've used "OutlookAddIn1", because that's the ProgID of my add-in. Controls can only fire callbacks into their own add-in, so although I can reference a control from a different add-in, I can't provide callback functions for those "foreign" controls, and nor can I invalidate them.