OL2002: Cannot Customize or Disable Context Menus (294223)



The information in this article applies to:

  • Microsoft Outlook 2002

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 "Folder Context Menu" Object

You can access a "Folder Context Menu" 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("Folder Context Menu").Enabled = False

End Sub
				
NOTE: The "Folder Context Menu" object was previously named "Context Menu" 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.

REFERENCES

For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:

287530 OL2002: Questions About Custom Forms and Outlook Solutions


Modification Type:MinorLast Reviewed:3/2/2004
Keywords:kbhowto KB294223