Microsoft KB Archive/294221

= OL2000: Cannot Customize or Disable Context Menus =

Article ID: 294221

Article Last Modified on 2/28/2004

-

APPLIES TO


 * Microsoft Outlook 2000 Standard Edition

-



This article was previously published under Q294221





SUMMARY
Microsoft Outlook does not provide functionality to customize the context menus that appear when you right-click various parts of the program.



MORE INFORMATION
The Outlook user interface does not provide any means to customize the context menus, although you can customize other menus and toolbars. The Outlook object model contains a CommandBars object that allows you to manipulate menus and toolbars programmatically, but the context menus are not exposed as a menu like other menus and toolbars are. In addition, you cannot develop a Microsoft Exchange Client Extension using the C/C++ programming language to manipulate Outlook context menus.

Unlike some other Microsoft Office programs, Outlook generates the context menus dynamically and immediately before they are displayed. This behavior is different than that of Microsoft Word or Microsoft Excel, which support fully customizable menus and toolbars.

Accessing the &quot;Context Menu&quot; Object
Starting in Microsoft Outlook 2000, you can access a &quot;Context Menu&quot; object in a Windows Explorer collection of command bars. However, this object is only available after you right-click in an Explorer window, which makes it impractical to use in custom solutions. In addition, context menus are not exposed for Inspector objects. The following Outlook Visual Basic for Applications code sample can be used as a basis to illustrate this behavior:

Sub ShowCommandBars

' Display all the available CommandBars for the ActiveExplorer. ' Change ActiveExplorer to ActiveInspector to test item windows. Set cbs = ActiveExplorer.CommandBars For Each cb In cbs MsgBox cb.Name Next ' Disable the context menu. ' Only works if the context menu is first displayed. ActiveExplorer.CommandBars(&quot;Context Menu&quot;).Enabled = False

End Sub NOTE: The &quot;Context Menu&quot; object has been renamed to &quot;Folder Context Menu&quot; in Microsoft Outlook 2002. If you plan to use this functionality in any way, you need to take this into account if your solution will used with both Outlook 2000 and Outlook 2002.

