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 2010 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.

link to video 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 application-level projects for Outlook 2013 and Outlook 2010. For more information, see Features Available by Office Application and Project Type.

Adding a Custom Ribbon to the Main Application UI

The main application UI in Outlook is called the Explorer. If you are using the Ribbon (Visual Designer) item, you can add a ribbon to the Explorer by clicking the RibbonType property of the ribbon in the Properties window, and then selecting Microsoft.Outlook.Explorer.

Assigning a Ribbon to an Inspector

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.

Specifying the Ribbon Type by Using Ribbon XML

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.

Public Function GetCustomUI(ByVal ribbonID As String) As String _
    Implements Office.IRibbonExtensibility.GetCustomUI

    Dim ribbonXML As String = String.Empty

    If ribbonID = "Microsoft.Outlook.Mail.Compose" Then
        ribbonXML = GetResourceText("Trin_RibbonOutlookBasic.Ribbon1.xml")
    End If 

    Return ribbonXML
End Function
public string GetCustomUI(string ribbonID)
{
    string ribbonXML = String.Empty;

    if (ribbonID == "Microsoft.Outlook.Mail.Compose")
    {
        ribbonXML = GetResourceText("Trin_RibbonOutlookBasic.Ribbon1.xml");
    }

    return ribbonXML;
}

See Also

Concepts

Accessing the Ribbon at Run Time

Ribbon Designer

Ribbon XML

Other Resources

Ribbon Overview