Customize Context Menus

Outlook Developer Reference

Several different context menus can be customized in Microsoft Office Outlook 2007, allowing add-ins to change, disable, or hide existing menu items as well as add or remove new menu items.

Office Outlook 2007 uses a set of events, associated with the Application object, to allow add-ins to examine and modify context menus before display. These events are similar in functionality, in that they provide two objects:

  • A CommandBar object that represents the context menu to be displayed.
  • An object that represents the item for which the context menu is displayed. This object may either be a single reference to the selected item or a collection containing one or more selected items, depending on the event.

In addition, the ContextMenuClose event is provided to notify add-ins and applications when a context menu has closed. This event allows add-ins to dispose of object references and perform cleanup operations.

Customizable Context Menus

In Office Outlook 2007, only the following context menus have events associated with them:

  • Attachment context menus
  • Folder context menus
  • Item and selection context menus
  • Shortcut context menus
  • Store context menus
  • View context menus

Attachment Context Menus

An attachment context menu can be displayed from the active inspector for either a single highlighted Attachment object or one or more selected Attachment objects associated with an Outlook item. You can use the AttachmentContextMenuDisplay event to customize the attachment context menu.

Folder Context Menus

A folder context menu can be displayed from the Navigation Pane for a single selected or highlighted Folder object, or from the current view for a single selected Folder object. You can use the FolderContextMenuDisplay event to customize the folder context menu.

Item and Selection Context Menus

A selection context menu can be displayed from the active explorer or inspector for one or more selected Outlook items, while an item context menu can be displayed from the active explorer or inspector for a single highlighted Outlook item. Item and selection context menus are supported for the following objects:

The ItemContextMenuDisplay event is used to customize both item and selection context menus.

Shortcut Context Menus

A shortcut context menu can be displayed from the Navigation Pane for a selected OutlookBarShortcut object. The ShortcutContextMenuDisplay event is used to customize the shortcut context menu.

Store Context Menus

A store context menu can be displayed from the Navigation Pane for a selected Store object. The StoreContextMenuDisplay event is used to customize the store context menu.

View Context Menus

A view context menu can be displayed from the View Pane for a selected View object. The ViewContextMenuDisplay event is used to customize the view context menu.

See Also