Toggle Ribbon Button in Outlook Inspector

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

Toggle Ribbon Button in Outlook Inspector
 
Jacob Rath


Guest


Hi,

I've got Add-in Express?Â?Ô?? 2010 for Microsoft??? Office and .net and developing an Outlook AddIn for Outlook 2007

I want to do this:

A Toggle Button in the Mail Compose-Inspector initialize its Pressed-State from a varable in my AddInModule. When someone clicked the Button the Status will changed and do not save the state in the AddInModule. When the User clicks the send Button I need to read the Pressed-State from the Button in the inspector and do something.

I already read the Online Documentation http://www.add-in-express.com/docs/net-ribbon-components.php

My Questions:

1) How can I Initialize the Toggle Button when a new Inspector window is loaded?
The PropertyChanging-Event only fires the first time the Button is created. When I open another new Mail the event will not fire.
I know in the documentation I've readed "because Ribbon is a static thing from birth". But in my VSTO-AddIn (without AddInExpress) I have Created a Class derived from "Microsoft.Office.Tools.Ribbon.OfficeRibbon" and there the constructor or OnLoad-Event is called for every Inspector.

2) How can I read the state of the Button in an Inspector? (for example when the SendButton is pressed).



Thanks
Posted 06 May, 2011 03:38:10 Top
Eugene Astafiev


Guest


Hi Jacob,

1. Please use the NewInspector or InspectorActivate events of the ADXOutlookAppEvents component for initializing the Toogle button. You just need to set up the Pressed property of the ADXRibbonButton class.

2. I can propose you three possible ways of doing this:

a. You can intercept the Send button using the ADXRibbonCommand component.
b. In that case you need to handle the PropertyChanging event of the toogle button and save its state to a local variable (more preferred).
c. You can handle the ItemSend event of the ADXOutlookAppEvents component (not preferred).

Which way do you prefer?

FYI To get assistance with host applications?Â?Ð?é objects, their properties, and methods as well as help info, use the Object Browser. Go to the VBA environment (in the host application, choose menu Tools | Macro | Visual Basic Editor or just press {Alt+F11}), press {F2}, select the host application in the topmost combo and/or specify a search string in the search combo. Select a class /property /method and press {F1} to get the help topic that relates to the object.
Posted 06 May, 2011 06:43:19 Top
Jacob Rath


Guest


Thanks for the answer.

Now I use the NewInspector-event to create an instance of my OutlookItemEventsClass. In this class I initialize a local variable for the toggle button. In the PropertyChanging event of the toggle Button I set the button reading the local variable from the OutlookItemEventsClass-instance (only when the pressed PropertyType is changed). In the Click-event of the toggle button I save the state in the variable and in the ProcessSend event I read the local variable and DoMyWork.

To identify the OutlookItemEventsClass-instance for an inspector I use the inspector.CurrentItem.

I also created an event handler for my global config-class. When someone change the global config, the toggle button state for all inspectors is changed (when the inspector gets the focus).

I think in this case the use of ADX is a bit more complex than VSTO, but in my other cases it saves me much time.
Thanks for this great Product!!!
Posted 09 May, 2011 02:26:34 Top
Eugene Astafiev


Guest


You are welcome, Jacob!
Posted 09 May, 2011 05:13:42 Top