Programming Outlook add-in / plugin
in Visual Studio .NET - C++, C#, VB.NET, Chrome

Add-in Express™ 2007
for Outlook® Express and Microsoft® .net

See the most recent documentation in the Add-in Express 2007 Developer Guide:
Writing Outlook 2007 - 2000 add-in / plugin in C#, C++, VB.NET

Add-in Express .NET and Outlook add-ins

To considerably facilitate programming of Outlook COM add-ins, or plug-ins, in Visual Studio, Add-in Express 2007 for .NET provides several specific features that are a "hard nut" to implement using Outlook objects. These features are: special Outlook Explorer command bars, special Outlook Inspector command bars, option pages and Folder property pages, context sensitivity for command bars and option/property pages.

With Add-in Express you can write a COM add-in for Microsoft Outlook 2000, 2002 (XP), 2003 and Outlook 2007 in C++, C#, Visual Basic (VB .NET) and RO Chrome.

1. Create a new Outlook COM add-in project

In the Visual Studio IDE, select the "New | Project" item on the main menu, and run the "Add-in Express COM Add-in" wizard via the "Other Projects | Extensibility Projects" item of the "New Project" dialog box. Enter your project name, click Next, choose a programming language, select Outlook as a host application for your add-in and click Finish. The wizard generates a new add-in solution and opens it in Visual Studio. The Outlook COM add-in solution includes the add-in project and a setup project  (optional).

A wizard for creating Outlook COM Add-in project

Benefits:

  • You can use any programming language to create an add-in for any Outlook versions from all Office suits (editions).
  • You can use Outlook 2000 PIAs (Primary Interop Assemblies) without installing Outlook 2000 on your PC.
  • The COM Add-in Project wizard creates both COM Add-in project and the Setup project automatically.

2. Add-in Module in Outlook add-in projects

AddinModule.vb (AddinModule.cs) is the heart of your add-in. You place components onto the Add-in Module designer instead of programming the user interface of your Outlook add-in. You also write the code of your add-in to the Add-in module. 

COM Add-in designer

Benefits:

  • All Outlook versions and editions are supported
  • Outlook-targeted properties
  • Your interface-related code is concentrated in one place
  • Rapid Application Development approach is applied to Outlook COM add-ins for the first time
  • Several add-ins in one assembly - just add another Add-in Module to your Outlook Add-in project
  • You create the user interface of your Outlook add-in at design-time

Essential technical information:

Add-in name, description, and load behavior
Supported Office applications - you choose Outlook
Collection of custom task panes (Office 2007)
Host application name, type, version, and object
When the add-in completes start-up routines or is required to shut down
Before and after a custom task pane is created or shown, before a task pane is destroyed
Before the ribbon XML markup is created and loaded, after ribbon XML markup is loaded

3. Customizing Outlook Ribbon user interface

Add appropriate Ribbon-related components to the Add-in module and use their editors to customize your add-in's interface in Office 2007.

Editor for customizing Outlook Ribbon interface

Benefits:

  • You create Office 2007 XML markup with components.
  • Simple properties add your custom Ribbon tabs or Ribbon Office menu items to any context of the Ribbon-enabled Outlook 2007 Inspector window.

Essential technical information:

Ribbon tab caption and position
Supported ribbons and context (say, Pivot Table in Excel or table in Word)
Visible (Boolean)

4. Creating Outlook custom task panes

Add a UserControl to your project, add an item to the TaskPanes collection, and set up the item by choosing the UserControl in the ControlProgId property and filling in the Title property.

Adding custom task panes to Outlook add-in

Benefits:

  • You use familiar technologies for programming Outlook 2007 custom task panes.

Essential technical information:

Task pane title, width and height
The UserControl bound to the task pane
Dock position and dock position restrictions
Outlook as a supported Ribbon-enabled applications
Visible (Boolean)
When the user changes the dock position or the visible state of the task pane
Before and after a custom task pane is created or shown, before a task pane is destroyed

5. Traditional command bars and commandbar controls in Outlook

Add one or more special Outlook Explorer CommandBar and Outlook Inspector CommandBar component to the Add-in Module and populate its Controls collection using a handy editor. Bind the component to a built-in Outlook command bar specifying the command bar name in the component's CommandBarName property. Create a custom command bar specifying a unique name in the CommandBarName property. Use the Folder Name, FolderNames, and ItemTypes properties to add context-sensitivity to your toolbars.

Components for creating and populating Outlook command bars

Benefits:

  • Simple Outlook-oriented components to create or connect to custom and built-in toolbars, menus, and context menus.
  • Context-sensitive command bars - you specify one ore more folders and/or a folder's default item types for the command bar to show up.
  • Add custom .NET controls to your toolbars with Toolbar Controls 2007 for Microsoft Office.

Essential technical information:

Command bar name, description, position, and protection
Folder name(s) and/or a folder's default item types which the command bar is shown for
Boolean properties: Temporary, Enabled, and Usable for Ribbon-enabled applications
Collection of command bar controls: buttons, combo boxes, dropdown lists, edits, popups. Also, any .NET controls can be added to a command bar with Toolbar Controls 2007 for Microsoft Office
Click - for command bar button
Change - for command bar combo box, dropdown list, and edit
All events for custom .NET controls (see Toolbar Controls 2007 for Microsoft Office)

6. Outlook options pages and folder property pages

Add a special Outlook Property Page component to your project, bind the component to the Add-in module, and specify the Title of the Options page. Use the same technique to create context-sensitive property pages for the Folder Properties dialog.

Outlook option page component

Benefits:

  • A simple UserControl-based component to customize Outlook Options dialog and Folder Properties dialog.
  • Context-sensitive Folder Property pages. 
  • Use Dirty and Apply events to handle user input to the pages.

Essentials:

Folder name(s) and/or a folder's default item types which the folder property page is shown for
All UserControl properties
When the user changes the option page, when the user clicks the Apply button
All UserControl events

7. Advanced Outlook customizations

Use View Regions and Advanced Form Regions provided by the Add-in Express 2007 Extensions for Microsoft Outlook for customizing Outlook user interface and programming commercial-class Outlook add-ins.

8. Intercepting keyboard shortcuts in Outlook add-ins

Add a Keyboard Shortcut component to the Add-in module and specify the shortcut you need to intercept.

Keyboard Shortcut component

Then you handle the Action event of the component.


Private Sub MyActionProc(ByVal sender As System.Object) _
      Handles AdxKeyboardShortcut1.Action
      MsgBox(AdxKeyboardShortcut1.ShortcutText + " has been pressed!")
End Sub

Benefits:

  • The component just saves your time.

Essential technical information:

Enabled (Boolean)
Shortcut Text
Supported Office Applications
When the keyboard shortcut is pressed by the user

9. Deploying Outlook add-in

Add-in Express add-ins are based on the Add-in Express Loader which is a feature-rich shim and bootstrap application.

Just build the setup project

With automatically generated setup project, the Add-in Express Loader provides you with the following benefits:

  • Manifest-configured features: setup log, non-admin installation, updating an add-in  while it is loaded
  • Ready-to-use custom actions for your setup project: just build the setup project
  • Per-user and per-computer add-in installations
  • You can sign the Add-in Express Loader with a digital certificate thus making your add-ins trusted

See also: Free sample Outlook add-in in .NET