Disable controls in Outlook 2007?

F

fbs 419

In my addin, I disable controls by getting the control id want, and doing a put_Enable false on it. For example, to disable Send Update for a meeting in Outlook 2003, I do this for id 1983 (Standard, Send Update), and it works.

In Outlook 2007, Send Update is a large button, and the same code does not work. I assumed that the event id was 1983, but for this button, perhaps not. How do I find the proper id for that button? I can't seem to find them anywhere.

In another Outlook 2007 case, I would like to disable the Cancel Meeting button (which is on the ribbon), or at least the Send Cancellation button, which is in the same place as Send Update, but after you push the Cancel Meeting button. Again, what are the ids for these controls? I have a spreadsheet for 2003, and I use Outlook Spy to get some of these, but they must not be the right ones.

And lastly, in Outlook 2003, I am trying to disable the File->Delete (also the X button), so I am using id 478. This doesn't work either -- I still see these things enabled.

Ideas?

Thanks
 
K

Ken Slovak - [MVP - Outlook]

For Outlook 2003 478 is the correct id for File, Delete. Are you waiting to
get that CommandBarButton object until the user interface for the Inspector
is fully realized, usually at the first Inspector.Activate() event?

For Outlook 2007 you need to use the ribbon controls and not the CommandBar
controls. You cannot disable built-in ribbon controls unless you add XML
markup for the ribbon controls that sets the enabled property to false.

See http://msdn.microsoft.com/en-us/library/aa338202.aspx for more
information on customizing the ribbon in Office 2007.
 
F

fbs 419

Thanks for the info -- I will check it out. I am getting all these button controls in a method that is called from OnActivateExplorer (using C++). I'll do more checking into the order that I do things.

So any info on the Send Update (and Send Cancellation) button in 2007, which is not part of the ribbon? Does that have another id?

Thanks
 
K

Ken Slovak - [MVP - Outlook]

You have to look up the msoID values (equivalent to command bar control
id's) for any controls you want to use. Download the documentation on the
ribbon from the Office Developer Web site and see what's available to you
and what the idMso's are.
 
F

fbs 419

Kind of strange. In Outlook 2003, my Send Update is now disabled, but File Delete is not. You did mention:

"Are you waiting to get that CommandBarButton object until
the user interface for the Inspector is fully realized,
usually at the first Inspector.Activate() event?"

Should I be waiting or not?

I do the same thing for Send Update (1983) as I do for File Delete (478), but one works and one doesn't. In File Delete, both the menu item and the X still display, while Send Update is grayed.
 
K

Ken Slovak - [MVP - Outlook]

I don't know, you'd have to search for examples in C++. You can see if
www.outlookcode.com has any and do a google search. Most of the samples I've
seen, and all of my own, are in either C#, VB.NET or VB 6.
 
K

Ken Slovak - [MVP - Outlook]

I certainly would wait until the first Activate, yes. See if that helps.
 
F

fbs 419

Thanks -- definitely getting somewhere with 2003. You were right -- waiting to do the

spControl->put_Enabled(VARIANT_FALSE)

on id 478 until the Inspector is fully realized fixed it for the X button. However, the File->Delete menu item, which is the same id still doesn't work. So I wonder if that has to be done even later. I figured the same put_Enabled should work for both the button and the menu item.

As for 2007, there are no examples in C++ that I can find. Are you saying that I need to add XML markup for ribbon controls even for things like the Send Update button (on a meeting) which is not part of the ribbon? I downloaded 2007OfficeControlIDsExcel2007.EXE -- that has a bunch of spreadsheets -- but I'm not sure what the idMso's are. It has the Policy Ids -- I assume they're the same as the old command ids.

Thanks a lot for all the help
 
K

Ken Slovak - [MVP - Outlook]

Both File, Delete and Delete on the Standard toolbar have an ID of 478 but
to disable them you'd need to access them separately and somewhat
differently. For the File, Delete button you need to use
Inspector.CommandBars["Menu Bar"].FindControl(), with the Recursive argument
set to true. To get at the delete button on the Standard toolbar you can use
Inspector.CommandBars["Standard"].FindControl(). That should let you handle
both instances of the control.

There are 5 different ribbons for meetings, such as
OutlookMeetingResponseComposeItemRibbonControls and
OutlookMeetingRequestComposeItemRibbonControls, etc. So you have to make
sure to handle the ribbon or ribbons you want. In some cases that might mean
handling multiple ribbons with one or more ribbon XML markups.

My copies of the ribbon XML spreadsheets don't have a column labeled Policy
Id's but the ribbon names are in the first column. The SendDefault button is
what you're looking for and it's listed as on the TabNewMailMessage tab, in
the GroupSend area.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top