共用方式為


Overview of Customizing the Ribbon

Similar to other Microsoft Office applications such as Microsoft Word, Microsoft Excel, and Microsoft PowerPoint, Microsoft Outlook uses the Microsoft Office Fluent user interface ribbon in its explorer and inspector windows. In an item inspector, such as an e-mail message in compose mode, Outlook uses the ribbon to expose commands in item-specific elements that make it easy for users to identify the commands they need to complete their tasks.

To customize the ribbon programmatically, Outlook uses ribbon extensibility. Each Outlook add-in can specify a custom user interface in an XML markup file, and then implement the IRibbonExtensibility interface. Office calls the IRibbonExtensibility.GetCustomUI method before the ThisAddin.Startup method to load ribbon customizations for the explorer ribbon, and calls the GetCustomUI method the first time that it displays a particular type of inspector. When it is called, the GetCustomID method takes a ribbon ID as an argument and loads the corresponding XML that your add-in associates with that ribbon ID. Consider using a Switch statement when you implement the GetCustomID method to load the ribbon XML for various ribbons; it is probably the most efficient way to accommodate the variety of ribbons that you might customize.

For a complete listing of ribbon identifiers, see Implementing the IRibbonExtensibility Interface.

For a detailed discussion of the ribbon and ribbon extensibility, see Overview of the Office Fluent Ribbon.

See Also

Concepts

Detecting Errors

Updating Earlier Code for CommandBars

Overview of the IRibbonUI Object

Overview of the IRibbonControl Object

Office Fluent User Interface Extensibility for Outlook