Customizing a Ribbon for Outlook
When you customize the ribbon in Microsoft Office Outlook, you must consider where your custom ribbon will appear in the application. Outlook displays the ribbon in the main application user interface (UI) and in windows that open when users perform certain tasks, such as creating e-mail messages. These application windows are named inspectors.
For a related video demonstration, see How Do I: Use the Ribbon Designer to Customize the Ribbon in Outlook?.
Applies to: The information in this topic applies to VSTO add-in projects for Outlook. For more information, see Features Available by Office Application and Project Type.
You identify the inspector you want to customize by specifying the ribbon type that corresponds to the message class for the Inspector.
If you are using the Ribbon (Visual Designer) item, click the RibbonType property of the ribbon in the Properties window, and then select one or more ribbon IDs from the list of values.
You can add more than one ribbon to a project. If more than one ribbon shares a ribbon ID, override the CreateRibbonExtensibilityObject method in the ThisAddin class of your project to specify which ribbon to display at run time. For more information, see Ribbon Overview. For more information about each ribbon type, see the technical article Customizing the Ribbon in Outlook 2007.
If you are using the Ribbon (XML) item, check the value of the ribbonID parameter in the GetCustomUI method and return the appropriate ribbon.
The GetCustomUI method is automatically generated by Visual Studio in the ribbon code file. The ribbonID parameter is a string that identifies the Explorer or a specific type of inspector. For a complete list of the possible values of the ribbonID parameter, see the technical article Customizing the Ribbon in Outlook 2007.
The following code example demonstrates how to display a custom ribbon only in the Microsoft.Outlook.Mail.Compose inspector. This is the inspector that opens when a user creates a new e-mail message. The ribbon to display is specified in the GetResourceText() method, which is generated in the Ribbon class. For more information about the Ribbon class, see Ribbon XML.