Microsoft KB Archive/294223

= OL2002: Cannot Customize or Disable Context Menus =

Article ID: 294223

Article Last Modified on 3/2/2004

-

APPLIES TO


 * Microsoft Outlook 2002 Standard Edition

-



This article was previously published under Q294223





SUMMARY
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;Folder Context Menu&quot; Object
You can access a &quot;Folder Context Menu&quot; object in the collection of command bars in Windows Explorer. 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;Folder Context Menu&quot;).Enabled = False

End Sub NOTE: The &quot;Folder Context Menu&quot; object was previously named &quot;Context Menu&quot; in Microsoft Outlook 2000. 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.

