Keeping track of a built in control? Or How to detect a saveable item in Outlook 2010
-
12 Mart 2012 Pazartesi 22:30
Hi!
I want to build a custom button in the backstage view within Outlook 2010. This button is a custom save as button. Pressing the button should open the file dialog with a pre selected folder. This button should not be enabled all the time. It should behave like the built in save as button. It should be enabled when a saveable item is selcted. To figure out when and in which all the situations the save as button is saveable is to much work since their could be different situations.
My idea was to track the built in save as button. When ever the backstage view is shown the custom save as button is going to be invalidated. That means the getEnabled callback for the custom save as button is executed. In that callback I wanted to read out the enabled state of the built in save as button and return that value. In this way the custom save as button is always enabled when the built in one is enabled. After research I have figured out that tracking the state of a (built in) control is impossible.
Is there a different way to figure out when the custom save as button should be enabled or not? Or better than that, is there a way to keep track of a control's state?
Yavuz
Tüm Yanıtlar
-
13 Mart 2012 Salı 09:06
CommandBars.GetEnabledMso("FileSave") does not work?- Yanıt Olarak İşaretleyen Yavuz T 13 Mart 2012 Salı 12:06
-
13 Mart 2012 Salı 12:06
Hi DamianD!
I am doing in my getenabled callback function this
public bool FileSaveAsCustomGetEnabled(IRibbonControl control) { var cbs = Globals.ThisAddIn.Application.ActiveWindow().CommandBars as Office.CommandBars; var enabled = cbs.GetEnabledMso("FileSaveAs"); return enabled; }and it seems to be working. Thank You!
Yavuz