Outlook Inspector Ribbon Management

Add-in Express™ Support Service
That's what is more important than anything else

Outlook Inspector Ribbon Management
 
Eranga Weeraratne




Posts: 50
Joined: 2011-10-19
Hi,

In ADX Events for Outlook, I notice 2 events to detect CommandBars in an Inspector, namely InspectorAddCommandBars and CommandBarsUpdate. Is there any event to handle Ribbon Tabs/Groups or Buttons addition/update in Inspectors?

Is there something equivalent to Ribbon XML in ADX?

I'm searching for a method to hide/show existing Outlook original Ribbons in the current Inspector (not ones added by my Add-in and also the show/hide should apply only to the current Inspector), in NewInspector event.

Tks,
- Eranga
Posted 21 Dec, 2011 23:18:17 Top
Eugene Astafiev


Guest


Hi Eranga,

Please note that the Ribbon UI is static thing from its birth. You can read more about this in the http://msdn.microsoft.com/en-us/library/aa338202%28v=office.12%29.aspx article in MSDN. A possible dynamism in the Ribbon UI is to use the PropertyChanging event of the ribbon controls (also known as ribbon callbacks).

So, please try to add a new ADXRibbonTab component, specify a value for the IdMso property and try to handle the PropertyChanging event of the ribbon tab. For example:

private void adxRibbonTab1_PropertyChanging(object sender, ADXRibbonPropertyChangingEventArgs e)
{
    if (e.PropertyType == ADXRibbonControlPropertyType.Visible)
    {
        e.Value = false; // hide 
    }
}
Posted 22 Dec, 2011 01:28:56 Top
Eranga Weeraratne




Posts: 50
Joined: 2011-10-19
Hi Eugene,

Thanks for your reply.

In ADX Add-in I notice there's a OnRibbonBeforeLoad event, inside which I can get/set the RibbonUI XML. Is there a way that I can retrieve the existing XML spec for the RibbonID, add/remove/modify certain objects and assign inside the OnRibbonBeforeLoad event.

I.e. get the Outlook built-in Ribbon XML spec for Microsoft.OMS.MMS.Read and alter it inside the event?

Tks,
- Eranga
Posted 22 Dec, 2011 03:13:28 Top
Andrei Smolin


Add-in Express team


Posts: 18842
Joined: 2006-05-11
Hi Eranga,

In a way, yes. All built-in Ribbon controls are listed in the download at http://www.microsoft.com/downloads/details.aspx?FamilyID=4329d9e9-4d11-46a5-898d-23e4f331e9ae&DisplayLang=en. Please find more details about it in the section "Referring to Built-in Ribbon Controls" in {Add-in Express}\Docs\adxnet.pdf on your PC.

Note that the Ribbon XML described custom things, it doesn't describe built-in controls.

That is, in OnRibbonBeforeLoad, you get or set the Ribbon XML that Add-in Express creates using Ribbon components that you added to the add-in module.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Dec, 2011 03:47:54 Top
Eranga Weeraratne




Posts: 50
Joined: 2011-10-19
Hi Andrei,

Thanks for your reply.

I already have the files in the links you sent, but it has only the Control IDs. I was thinking if there's a way to retrieve the full XML spec of the existing Ribbon Controls?

Rgds,
- Eraga
Posted 22 Dec, 2011 05:09:36 Top
Andrei Smolin


Add-in Express team


Posts: 18842
Joined: 2006-05-11
Hi Eranga,

Retrive? From where? The only source of such info is that download. The answer is "No".

The Ribbon XML contains only custom things, say it may describe a custom or built-in button that you put into a custom group and add the group to a custom or built-in tab. You can create a Ribbon XML to add built-in controls; this is useful if you use StartFromScratch.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Dec, 2011 05:36:59 Top
Eranga Weeraratne




Posts: 50
Joined: 2011-10-19
Hi Andrei/Eugene,

Using Ribbon XML, I'm trying to put a Ribbon button to an existing Ribbon Group in Mail Compose inspector. However it doesn't show. Below is the XML I'm using in ADX Add-in testing in Outlook 2007.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onL oad="ribbonLoaded_Callback" loadImage="getImages_Callback">
<ribbon startFromScratch="false">
<tabs>
<tab id="TabNewMailMessage">
<group id="GroupNames" label="Clipboard">
<button id="CheckNames2" imageMso="HappyFace" label="PPPP" size="large" onAction="CustomSmsSendHandler" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

What am I doing wrong?

Also in the same test, I tried to override the existing "CheckNames" control by naming the id of above button the same. However it doesn't work either. What should be the behavior in such case?

In OnRibbonLoaded event, is there a way to iterate through the list of controls in the current Inspector and show/hide ribbons?

Thanks in advance,
- Eranga
Posted 22 Dec, 2011 06:30:16 Top
Andrei Smolin


Add-in Express team


Posts: 18842
Joined: 2006-05-11
Hi Eranga,

First off, adding custom controls to a built-in group is prohibited by the Ribbon API.

I strongly recommend that you check the sections "How Ribbon Controls Are Created?", "Referring to Built-in Ribbon Controls" and "Intercepting Built-in Ribbon Controls" in the manual.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Dec, 2011 07:32:39 Top
Eranga Weeraratne




Posts: 50
Joined: 2011-10-19
Hi Andrei,

I have read those documents before, but I am faced with limitations in using ADX Ribbon Command or Ribbon Tab to enable/disable or show/hide built-in Ribbons, since ADX doesn't have the enumeration type for the OMS built-in Ribbon control in Outlook 2007. It is called "Microsoft.OMS.SMS". ADX has OMS types for Outlook 2010.

Is it possible for me to give the relevant value of "Microsoft.OMS.SMS" to RibbonCommand.Ribbons? If not, is there a possibility that you can add this type to AddinExpress.MSO.ADXRibbons.*?

Tks,
- Eranga
Posted 23 Dec, 2011 00:31:10 Top
Andrei Smolin


Add-in Express team


Posts: 18842
Joined: 2006-05-11
Hi Eranga.

The fact is: Add-in Express doesn't impose these limitations; their roots are in the Ribbon API. Say, you can find the same things in VSTO.

All Ribbon controls are listed in the downloads already mentioned. You can use them to create the Ribbon UI of your choice. A suggestion: when you customize the Quick Access toolbar, pay attention to the tooltips that all Ribbon commands display: the tooltip contains the IdMso of the control.

Since the downloads don't mention that Ribbon, you cannot expect that it exists.

Eranga Weeraratne writes:
Instead of ADX's own callbacks for Ribbon controls (eg. getEnabled_Callback), can I give a custom callback function in Addin module, directly to Ribbon XML?


Yes, you can. To achieve this, you need to supply a correct Ribbon XML to the e.XML parameter of the OnRibbonBeforeLoad event. The signatures of callbacks are given at http://msdn.microsoft.com/en-us/library/aa722523(office.12).aspx.


Andrei Smolin
Add-in Express Team Leader
Posted 23 Dec, 2011 02:31:07 Top