none
Enable and Disable controls in a Ribbon RRS feed

  • Question

  • Good morning all,

    I am developing an Outlook Addin which consists mainly of a Ribbon with two tabs.
    One of the tabs has a ControlId as "TabMail" and the other tab has a ControlId as "TabReadMessage". I would like to enable and disable the controls on the Ribbon under certain conditions.

    I did manage to achieve this for the "TabMail" tab by invalidating the controls and then issuing the Enable true or false. However, for some reason, I am not managing to enable/disable the controls under the "TabReadMessage" tab. 
    Any suggestions for a potential solution or what might be happening?

    Please note that I used the designer and not direct xml.

    Thanks a lot!

    Monday, July 15, 2013 9:17 AM

Answers

  • Hi Yuri,

    I managed to understand what was happening.

    The ribbon for "TabReadMessage" gets created when a new item (message) is opened and disposed when the item is closed. When a MailItem.Open or MailItem.ReadComplete event is fired; the ribbon would have not initialized. Hence, I could not invalidate the ribbon's controls to be enabled/disabled as required. 

    To workaround the situation I used the Ribbon.Load event and perform the necessary enable/disable controls by reading a global struct.

    Wednesday, July 17, 2013 1:41 PM

All replies

  • if you're using ribbon xml, it would be easy.

    Perhaps you can share your code with the community? via skydrive or github.


    with regards, Yuri

    Wednesday, July 17, 2013 8:51 AM
  • Hi Yuri,

    I managed to understand what was happening.

    The ribbon for "TabReadMessage" gets created when a new item (message) is opened and disposed when the item is closed. When a MailItem.Open or MailItem.ReadComplete event is fired; the ribbon would have not initialized. Hence, I could not invalidate the ribbon's controls to be enabled/disabled as required. 

    To workaround the situation I used the Ribbon.Load event and perform the necessary enable/disable controls by reading a global struct.

    Wednesday, July 17, 2013 1:41 PM