Outlook 2010 GetRibbonControlPressed and RibbonControlExecute

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

Outlook 2010 GetRibbonControlPressed and RibbonControlExecute
 
Matt Newnham




Posts: 13
Joined: 2010-11-23
I have an add in which is working fine in Outlook 2007, where I set the sending address for a mail item before displaying the compose mail inspector to the user. This causes the From field to be displayed when the inspector loads, which is undesirable. I solved this in Outlook 2007 using the GetRibbonControlPressed and RibbonControlExecute procedures, passing the 'ShowFrom' id as a parameter, in the adxOutlookAppEventsInspectorActivate event of the adxOutlookAppEvents component. This event appears to be the last available event relating to creation/display of an inspector window (after adxOutlookAppEventsNewInspector and adxCOMAddInModuleOLInspectorActivate).

However in Outlook 2010 this approach does not work correctly. Attempting to call the GetRibbonControlPressed and RibbonControlExecute procedures within the adxOutlookAppEventsInspectorActivate event results in an exception with the message "The parameter is incorrect".

This can be recreated by creating a simple add in with an adxOutlookAppEvents component calling GetRibbonControlPressed('ShowFrom') in the activate event.

Can you advise me as to how to resolve this issue? Or suggest an alternative method for hiding the From field?

Many thanks,
Matt
Posted 23 Nov, 2010 09:35:34 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hi Matt,

I've reproduced this. Note that the control is missing in the MailCompose Ribbon UI. If you add it to the Quick Access Toolbar, you'll see that the control is disabled. I believe they had to do so because they use From differently in Outlook 2007 and 2010.

This makes me think it is impossible to hide the From control from the UI.


Andrei Smolin
Add-in Express Team Leader
Posted 24 Nov, 2010 11:35:39 Top
Matt Newnham




Posts: 13
Joined: 2010-11-23
Hi Andrei,
Thanks for getting back to me.
I'm not sure what you mean by the control is disabled? It's available to toggle through the options tab and I am able to toggle it from the quick access bar also.
The strange thing is that the RibbonControlExecute procedure works fine once the compose mail inspector is loaded. I have a drop-down to sel ect the sending address and I am able to execute RibbonControlExecute successfully fr om the OnChange event. The problem seems to be isolated to the InspectorActivate event.
Matt
Posted 25 Nov, 2010 03:19:42 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hi Matt,

Are you talking about Outlook 2007? I tested this in Outlook 2010, I cannot see how the From control (not just field) can be hidden in Outlook 2010 mail compose inspectors: the corresponding toggle button is missing in the ShowFields group on the Options tab and it is disabled when shown on the QAT.


Andrei Smolin
Add-in Express Team Leader
Posted 25 Nov, 2010 05:14:09 Top
Matt Newnham




Posts: 13
Joined: 2010-11-23
Hi Andrei,
Sorry for the confusion. I am using Outlook 2010.
User added an image

I've highlighted the Fr om control that I am attempting to hide.
I can do this using the toggle button above in the Show Fields group.
This works fine using RibbonControlExecute('ShowFrom') in Outlook 2007 and also works fine once the Inspector is loaded in Outlook 2010. It's only on the initial display of the inspector (in 2010), wh ere I set the sending address of the mail item, that RibbonControlExecute('ShowFrom') fails. This results in the inspector displaying with the From control and address sending from visible to the user, which is undesirable.
Posted 26 Nov, 2010 03:58:22 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hi Matt,

In my Outlook 2010 version 14.0.5128.5000 (32-bit) that toggle button is missing in the ShowFields group and it is disabled if I add it to the QAT.

What Outlook 2010 build and bitness are you using?
Also, try turning off all other COM add-ins. Is the button still there?


Andrei Smolin
Add-in Express Team Leader
Posted 26 Nov, 2010 09:07:04 Top
Matt Newnham




Posts: 13
Joined: 2010-11-23
Hi Andrei,

I'm using the exact same version (14.0.5128.5000 32-bit). I tried turning off each and all the add-ins, the toggle is still always present.

2010 does seem to have a couple of strange behaviours.

Matt
Posted 26 Nov, 2010 11:07:02 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hi Matt,

I've found the reason: the toggle is shown when running Outlook + Exchange; it isn't shown for Outlook runing on a PST. I've reproduced the issue with calling RibbonControlExecute('ShowFrom') in InspectorActivate. Calling it in the Click event of a button works fine. That is, you can try starting a timer in InspectorActivate and making the call in the Timer event.


Andrei Smolin
Add-in Express Team Leader
Posted 26 Nov, 2010 13:07:28 Top
Matt Newnham




Posts: 13
Joined: 2010-11-23
Thanks Andrei, I'll look into this solution.
Matt
Posted 29 Nov, 2010 03:04:10 Top