Customize Outlook 2007, 2003 toolbar /commandbar
Add buttons, NET & ActiveX controls: C#, VB.NET, C++
Toolbar Controls
Add any .NET controls to Outlook toolbarThe Toolbar Controls for Office makes possible to add any visual .NET controls, including a custom button, grid, label, tree-view, check box as well as visual ActiveX controls onto a standard or your own Outlook toolbar. Until now developers have been limited in choosing visual controls, since the Outlook Object Model (as well as the Office Object Model) allows only five types: button - msoControlButton, edit - msoControlEdit, drop down - msoControlDropDown, combobox - msoControlComboBox and popup - msoControlPopup, which are nothing more than shadows of familiar .NET controls. Say, command bar buttons don't provide the MouseOver event. Also, Office developers have been always interested in msoControlActiveX, its name assumes that ActiveX controls can be used on an Outlook commandbar. Unfortunately, this type is not properly implemented by Microsoft either. Now all these limitations are overpassed. With our tool you can use any .NET controls (Button, Label, Panel, CheckBox, ComboBox, ListView, ProgressBar, TreeView and visual ActiveX controls) side by side with built-in Office ones. It helps to customize Outlook toolbar and place any controls you want on both built-in and your own Microsoft Office Outlook command bars. How to customize Outlook toolbar with your own controlsThe step-by-step example below shows how to customize Outlook 2003 commandbar using Toolbar Controls for Microsoft Office in Visual Studio. Now we are going to add a DateTimePicker to the Outlook Explorer toolbar. In the same way you add any .NET controls for your custom or built-in toolbars in Outlook 2007, 2002 (XP) and 2000. This sample doesn't contain a single line of code. To reproduce the example below you can create a new add-in project based on Add-in Express and open its add-in module. Now, step-by-step. 1. Set toolbar propertiesCreate a new Outlook Explorer command bar in the add-in module and set its properties such as Position and CommandBarName. 2. Add a control adapterToolbar Controls for Microsoft Office adds to the Toolbox several special components that support .NET controls on a command bar of the corresponding Office application. There is an Outlook-specific component called ADXOutlookControlAdapter. The control adapter (read more about Control adapters below) makes possible interacting with the Toolbar Controls .NET and Microsoft Outlook. So, you add the adapter to the add-in module. 3. Add a .NET control to Outlook toolbarDrop the .NET control, which you want to place on the MS Outlook commandbar, onto the add-in module. Then you can customize the control via its properties and handle its events. In the example we use DateTimePicker (see the picture below). As you understand, you can add any visual .NET and ActiveX controls in the same way. Please note, for your ActiveX to work correctly, it should be properly implemented. 4. Bind your cutom control to Outlook toolbarAdd-in Express groups all controls into the Controls collection of the corresponding command bar component (ADXOlExplorerCommandBar in this case). This collection may include a special control that is necessary for placing your .NET control onto the MS Outlook command bar. It is ADXCommandBarAdvancedControl, so add an ADXCommandBarAdvancedControl to your Outlook toolbar. Then, you bind your .NET control to your Outlook CommandBar. So, select the added ADXCommandBarAdvancedControl in the Properties window and select your .NET control in the ADXCommandBarAdvancedControl. 5. Find your .NET control on Outlook commandbarFinally, you register your add-in project, run Outlook and find your toolbar customized with your .NET control. In the same way you can add any other .NET controls both standard (buttons, labels, etc.) and custom ones. You may also want to have a look at another sample project showing how to add a custom control (CheckBox) to Outlook toolbar. Control adaptersThe component adds a new tab, "Toolbar Controls for Microsoft Office", to the Toolbox and places several components on the tab. The Toolbar Controls supports each Office application with special components that we call Control Adapters. Only adapters know how to add your controls to applications specific command bars. All adapters can be contained by the add-in module only. For example, you should add an ADXExcelControlAdapter to the add-in module if you wand to use non-Office controls in your Excel add-in commandbar. To use non-Office controls on several Office applications you should add several adapters. So, if you need to use your controls in your add-in that supports Outlook, Excel and Word, you should add three control adapters: ADXExcelControlAdapter, ADXWordControlAdapter and ADXOutlookControlAdapter to the add-in module. The Outlook control adapter is optimized for placing .NET controls onto Outlook commandbar only. It makes possible using controls such as a button, textbox, label, etc. on two main windows - the Explorer and Inspector windows. With the control adapter you can customize command bars on all types of inspectors including contact, e-mail, task, appointment windows and customize commandbars for all Explorer windows. |