• [转]Extending the User Interface in Outlook 2010


    本文转自:https://msdn.microsoft.com/en-us/library/office/ee692172%28v=office.14%29.aspx#OfficeOLExtendingUI_ContextMenuforaMailItem

    Office 2010
     

    Summary: Learn how to programmatically extend the Microsoft Office Fluent user interface (UI) to customize the UI in Microsoft Outlook 2010. The Fluent UI in Microsoft Office 2010 includes the Office Fluent ribbon, menus, and Microsoft Office Backstage view. This article discusses how to customize the explorer and inspector ribbons, the menus and context menus, and Backstage view in the Outlook 2010 UI. It walks through a code sample that illustrates how to customize the ribbon, the context menus, and Backstage view, and examines specific issues that apply to the Outlook 2010 UI. (47 printed pages)

    Last modified: January 30, 2013

    Applies to: Office 2010 | Outlook 2010 | Visual Studio

    In this article 
    Overview 
    Sample Add-In 
    Ribbon Identifiers 
    Explorer 
    Inspector 
    Folder Context Menu 
    Root Search Folder Context Menu 
    Store Context Menu 
    Context Menu for a Mail Item 
    Context Menu for Multiple Selected Items 
    Context Menu for an Appointment or Meeting Request 
    Context Menu for a Task Item 
    Context Menu for a Contact Item 
    Context Menu for a Journal Item 
    Context Menu for a Note Item 
    Shortcut Context Menu 
    Attachment Context Menu 
    Table View Context Menu 
    Calendar View Context Menu 
    Card View Context Menu 
    Timeline View Context Menu 
    Menu for the Arrange By Command 
    Context Menu for Time Bar 
    Context Menu for Free/Busy Bar 
    Context Menu for a Table View Column 
    Categories Context Menu 
    Context Menu for Quick Flags 
    Context Menu for Flagged Mail Item 
    Context Menu for Flagged Contact Item 
    New Items Menu for Mail Module 
    New Items Menu for Calendar Module 
    New Items Menu for Contacts Module 
    New Items Menu for Tasks Module 
    New Items Menu for Journal Module 
    New Items Menu for Notes Module 
    Persona Context Menu for a Sender or Recipient 
    Menu for Alternative Interactions 
    Contextual Tabs 
    Backstage View 
    Conclusion 
    Additional Resources 

    Published:  November 2009 | Updated:  April 2010

    Provided by:  Randy Byrne, Microsoft Corporation

    Click to grab code   Outlook 2010 Sample: Extending the User Interface

    Contents

    Overview

     

    This article describes the many new ways that you can programmatically customize the following areas in the Outlook 2010 UI:

    • Explorer ribbons

    • Inspector ribbons

    • Context menus

    • New item menus

    • Contact Card context menus

    • Contextual tabs

    • Backstage view

    Specifically, this article explains how to use Fluent UI extensibility to customize the components in each of those areas. To begin, you must supply XML markup to the GetCustomUI method of the IRibbonExtensibility interface. Use the ribbon ID for the component that you want to customize to determine the XML to pass as a returned value in the GetCustomUI method. Your XML typically supplies callbacks that you can use to respond to a button click, or to control the visibility of your ribbon controls.

    This article lists the IRibbonControl.Context property that you should expect in Fluent UI extensibility callbacks in your code. In addition, it includes sample XML markup for each UI component, and a screenshot that illustrates the UI component to help you understand where the customization occurs in the Outlook 2010 UI.

    Note Note

    The ribbon IDs and components in this article might change in the final release of Outlook 2010. In some cases, the exact menu items on a menu or context menu depend on the suite of Microsoft Office 2010 installed and the type of Outlook item that is selected.

    Before you read this article, you should already have a basic understanding of how to extend the Fluent UI by using an add-in. If you are not familiar with Fluent UI extensibility, see the technical articles listed in the Additional Resources section.

    Sample Add-In

     

    This article has an accompanying sample add-in named RibbonXOutlook14AddinCS. It uses Microsoft Visual C# and requires Microsoft Visual Studio 2008 Service Pack 1 and Outlook 2010.

    Overview

    The sample add-in demonstrates how to customize the ribbons, menus, context menus, and Backstage view in Outlook 2010. Developed in Visual Studio 2008 Tools for Office, the add-in adds ribbon controls, a custom menu, context menu items, and Backstage view controls, and then displays a message box when the user clicks the control or menu item. The add-in provides a visual element for every entry point in the Outlook 2010 UI that you can customize by using Fluent UI extensibility.

    The sample add-in has some additional features that illustrate how to manage certain problem areas in the Outlook 2010 UI. For example, suppose that you want to show a custom group in the ribbon for received e-mail items only. The sample add-in displays the custom ribbon tab only when the selected item in the Outlook explorer is a received mail item or when the received mail item is displayed in an inspector. Although that might seem to be a trivial task at first, it is actually a complex problem because Outlook can display multiple explorer or inspector windows, and your code must be able to respond appropriately. For example, in two open explorer windows, you might have to hide the custom tab in the window that has a meeting selected, but display the custom tab in the window that has a received mail item selected. Once you understand how the sample add-in works, you can use the wrapper classes from the sample to build your own solution that can coordinate the display of your command UI in multiple Outlook windows.

    Installation Instructions

    To download the sample code installation package

    1. Download the OL2010ExtendingtheUserInterface_CS.zip file from Outlook 2010: Extending the User Interface in the MSDN Samples Gallery.

    2. Extract the .zip file into the folder of your choice. In Windows Vista, the default path for Visual Studio 2008 Tools for Office projects is C:UsersuserDocumentsVisual Studio 2008Projects.

    To run the Outlook Ribbon extensibility sample

    1. Close Outlook 2010.

    2. In the folder where you extracted the RibbonXOutlook14AddinCS.zip file, open the RibbonXOutlook14AddinCS solution.

    3. On the Build menu, click Build RibbonXOutlook14AddinCS.

    4. Start Outlook 2010 to start the add-in in run mode, or press F5 to start the add-in in debug mode. If Outlook does not start in debug mode, complete the following procedure.

    To start Outlook in debug mode

    1. In Solution Explorer, select RibbonXOutlook14AddinCS.

    2. On the Project menu, select RibbonXOutlook14AddinCS Properties, and then click the Debug tab.

    3. Under Start Action, select the Start External Program option, and then click Browse.

    4. In the [Drive:]Program FilesMicrosoft OfficeOffice14 folder, select Outlook.exe.

    5. Press F5 to start the add-in in debug mode.

    Code Walkthrough

    The Outlook14RibbonXAddinCS solution is built with Microsoft Visual Studio 2008 Service Pack 1. It uses manual authoring of XML markup files instead of the ribbon designer that is provided with Visual Studio Tools for Office. The most important architectural feature is the use of wrapper classes (OutlookExplorer.cs for explorers and OutlookInspector.cs for inspectors) to handle multiple Outlook windows. The wrapper classes are implemented by using a C# Generic List(T) class.

    Note Note

    If you are not writing managed code, you must write native C++ code that mimics the use of these wrapper classes.

    First, the following class-level instance variables are declared in the standard ThisAddin class in Visual Studio 2008 with Visual Studio Tools for Office.

     
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Windows.Forms;
    using System.Diagnostics;
    using Outlook = Microsoft.Office.Interop.Outlook;
    using Office = Microsoft.Office.Core;
    
    namespace RibbonXOutlook14AddinCS
    {
        public partial class ThisAddIn
        {
            #region Instance Variables
            Outlook.Application m_Application;             
            Outlook.Explorers m_Explorers;
            Outlook.Inspectors m_Inspectors;
            public stdole.IPictureDisp m_pictdisp = null;
            // List of tracked explorer windows.         
            internal static List<OutlookExplorer> m_Windows;
            // List of traced inspector windows.
            internal static List<OutlookInspector> m_InspectorWindows;
            // Ribbon UI reference.
            internal static Office.IRibbonUI m_Ribbon;
            #endregion
            ...
        }
    }
    
    

    Once the instance variables have been declared, they are used in the Startup method of the ThisAddin class that is provided to all Visual Studio 2008 with Visual Studio Tools for Office add-ins. In the Startup method, which typically occurs when Outlook starts, the code first hooks up an event handler to respond to the NewExplorer event on the Outlook Explorers collection object. After the NewExplorer event has been handled, the active explorer window is added by using the following code.

     
    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        // Initialize variables.
        m_Application = this.Application;
        m_Explorers = m_Application.Explorers;
        m_Inspectors = m_Application.Inspectors;
        m_Windows = new List<OutlookExplorer>();
        m_InspectorWindows = new List<OutlookInspector>();
    
        // Wire up event handlers to handle multiple Explorer windows.
        m_Explorers.NewExplorer += 
            new Outlook.ExplorersEvents_NewExplorerEventHandler(
                m_Explorers_NewExplorer);
        // Wire up event handler to handle multiple Inspector windows.
        m_Inspectors.NewInspector += 
            new Outlook.InspectorsEvents_NewInspectorEventHandler(
                m_Inspectors_NewInspector);
        // Add the ActiveExplorer to m_Windows.
        Outlook.Explorer expl = m_Application.ActiveExplorer()
            as Outlook.Explorer;
        OutlookExplorer window = new OutlookExplorer(expl);
        m_Windows.Add(window);
        // Hook up event handlers for window.
        window.Close += new EventHandler(WrappedWindow_Close);
        window.InvalidateControl += new EventHandler<
            OutlookExplorer.InvalidateEventArgs>(
            WrappedWindow_InvalidateControl);
        // Get IPictureDisp for CurrentUser on startup.
        try
        {
            Outlook.AddressEntry addrEntry = 
                Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry;
            if (addrEntry.Type == "EX")
            {
                Outlook.ExchangeUser exchUser = 
                    addrEntry.GetExchangeUser() as Outlook.ExchangeUser;
                m_pictdisp = exchUser.GetPicture() as stdole.IPictureDisp;
            }
        }
        catch (Exception ex)
        {
            // Write exception to debug window.
            Debug.WriteLine(ex.Message);
        }
    }
    
    

    Just after Outlook starts, Office calls GetCustomUI. GetCustomUI is the method of the IRibbonExtensibility interface that loads custom XML markup. In Outlook 2007, Office called GetCustomUI when the first instance of a given inspector type, such as a contact or appointment, was displayed. In Outlook 2010, Office calls GetCustomUI before the ThisAddin.Startup method to accommodate the loading of ribbon customizations for the Outlook explorer ribbon. Because Office calls GetCustomUI only once for the first Outlook explorer during startup and multiple times for the first instance of multiple inspector types, consider using a Switch statement to control loading of XML markup for different customized Ribbons. For each ribbon in Outlook, GetCustomUI is called and Office passes the ribbon ID string that identifies the ribbon that is being loaded in Outlook. For a complete listing of ribbon IDs, see the section Ribbon Identifiers.

    In the sample code, there are three XML markup files:

    • ContactCard.xml

    • Explorer.xml

    • ReadMail.xml

    ContactCard.xml contains XML markup for context menus on the Contact Card. Explorer.xml contains XML markup for the explorer ribbon, context menus, and Backstage view. Readmail.xml contains XML markup for a read mail inspector.

    To get a better idea of how this technique works, examine the following code from the GetCustomUI method in the OutlookRibbonXclass.

     
            
    public string GetCustomUI(string ribbonID)
    {
        string customUI = string.Empty;
        Debug.WriteLine(ribbonID);
        // Return the appropriate XML markup for ribbonID.
        switch (ribbonID)
        {
            case "Microsoft.Outlook.Explorer":
                customUI = GetResourceText( 
                    "RibbonXOutlook14AddinCS.Explorer.xml");
                return customUI;
            case "Microsoft.Outlook.Mail.Read":
                customUI= GetResourceText(
                    "RibbonXOutlook14AddinCS.ReadMail.xml");
                return customUI;
            case "Microsoft.Mso.IMLayerUI":
                customUI = GetResourceText(
                    "RibbonXOutlook14AddinCS.ContactCard.xml");
                return customUI;
            default:
                return string.Empty;
        }
    }
    
    

    Take a look at the sample solution for a complete listing of ContactCard.xml, Explorer.xml, and ReadMail.xml. Once custom XML markup has been loaded for each add-in, it is time to write code in Fluent UI extensibility callbacks to hide and show the tab named MyTab, depending on whether the selected item in the explorer is a received mail item. To complete the scenario, you must hook up another set of events in the constructor of the OutlookExplorer class.

     
            
    public OutlookExplorer(Outlook.Explorer explorer)
    {
        m_Window = explorer;
            
        // Hook up Close event.
        ((Outlook.ExplorerEvents_Event)explorer).Close +=
            new Outlook.ExplorerEvents_CloseEventHandler(
            OutlookExplorerWindow_Close);
    
        // Hook up SelectionChange event.
        m_Window.SelectionChange += 
            new Outlook.ExplorerEvents_10_SelectionChangeEventHandler(
            m_Window_SelectionChange);
    }
    
    

    The SelectionChange event handler is very straightforward. The SelectionChange event occurs whenever the user changes the selection in an explorer window. When SelectionChange occurs, the RaiseInvalidateControl method is called and the control ID "MyTab" is passed to the method. RaiseInvalidateControl calls an event delegate named WrappedWindow_InvalidateControl in the ThisAddin class.

     
            
    private void m_Window_SelectionChange()
    {
        RaiseInvalidateControl("MyTab");
    } 
    void WrappedWindow_InvalidateControl(object sender,
        OutlookExplorer.InvalidateEventArgs e)
    {
        if (m_Ribbon != null)
        {
            m_Ribbon.InvalidateControl(e.ControlID);
        }
    }
    
    

    The m_Ribbon variable represents an IRibbonUI object. When the InvalidateControl method of the IRibbonUI object is called, ribbon callbacks occur for the "MyTab" control. You could also call the Invalidate method of IRibbonUI, but that method causes callbacks for all of the controls that your add-in adds to the ribbon. In general, make your invalidation more granular than global, especially when your callbacks load image resources with a getImage callback. For the "MyTab" control, a getVisible callback has been defined in the RibbonXAddin class that controls the visibility of the tab. If the getVisible callback returns True, the tab is visible; otherwise, "MyTab" is hidden. The following code is the MyTab_GetVisible callback in its entirety.

     
            
    // Only show MyTab when explorer selection is 
    // a received mail or when inspector is a read note.
    public bool MyTab_GetVisible(Office.IRibbonControl control)
    {
        if (control.Context is Outlook.Explorer)
        {
            Outlook.Explorer explorer = 
                control.Context as Outlook.Explorer;
            Outlook.Selection selection = explorer.Selection;
            if (selection.Count == 1)
            {
                if (selection[1] is Outlook.MailItem)
                {
                    Outlook.MailItem oMail = 
                        selection[1] as Outlook.MailItem;
                    if (oMail.Sent == true)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        else if (control.Context is Outlook.Inspector)
        {
            Outlook.Inspector oInsp = 
                control.Context as Outlook.Inspector;
            if (oInsp.CurrentItem is Outlook.MailItem)
            {
                Outlook.MailItem oMail = 
                    oInsp.CurrentItem as Outlook.MailItem;
                if (oMail.Sent == true)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        else
        {
            return true;
        }
    }
    
    

    This walkthrough detailed the most important strategies for extending the ribbon in Outlook 2010. In summary, your code should support the following:

    • The use of multiple explorer or inspector windows in Outlook 2010. Wrap the windows in a separate class instance that can raise events appropriate to that specific window.

    • The appropriate use of the InvalidateControl or Invalidate methods of the IRibbonUI interface to cause callbacks to occur.

    • The evaluation of different item types (based on the message class, built-in properties, or custom properties of a specific item type) in both event handlers and ribbon callbacks.

    Ribbon Identifiers

     

    The following table lists the ribbon IDs that are passed to the GetCustomUI method of the IRibbonExtensibility interface. Use the ribbon ID to determine the XML to return in the GetCustomUI method.

    Table 1. Ribbon IDs and Message Class

    Ribbon ID

    Message class

    Microsoft.OMS.MMS.Compose

    IPM.Note.Mobile.MMS.*

    Microsoft.OMS.MMS.Read

    IPM.Note.Mobile.MMS.*

    Microsoft.OMS.SMS.Compose

    IPM.Note.Mobile.SMS.*

    Microsoft.OMS.SMS.Read

    IPM.Note.Mobile.SMS.*

    Microsoft.Outlook.Appointment

    IPM.Appointment.*

    Microsoft.Outlook.Contact

    IPM.Contact.*

    Microsoft.Outlook.DistributionList

    IPM.DistList.*

    Microsoft.Outlook.Journal

    IPM.Activity.*

    Microsoft.Outlook.Mail.Compose

    IPM.Note.*

    Microsoft.Outlook.Mail.Read

    IPM.Note.*

    Microsoft.Outlook.MeetingRequest.Read

    IPM.Schedule.Meeting.Request or IPM.Schedule.Meeting.Canceled

    Microsoft.Outlook.MeetingRequest.Send

    IPM.Schedule.Meeting.Request

    Microsoft.Outlook.Post.Compose

    IPM.Post.*

    Microsoft.Outlook.Post.Read

    IPM.Post.*

    Microsoft.Outlook.Report

    IPM.Report.*

    Microsoft.Outlook.Resend

    IPM.Resend.*

    Microsoft.Outlook.Response.Compose

    IPM.Schedule.Meeting.Resp.*

    Microsoft.Outlook.Response.CounterPropose

    IPM.Schedule.Meeting.Resp.*

    Microsoft.Outlook.Response.Read

    IPM.Schedule.Meeting.Resp.*

    Microsoft.Outlook.RSS

    IPM.Post.Rss.*

    Microsoft.Outlook.Sharing.Compose

    IPM.Sharing.*

    Microsoft.Outlook.Sharing.Read

    IPM.Sharing.*

    Microsoft.Outlook.Task

    IPM.Task.* and IPM.TaskRequest.*

    Microsoft.Outlook.Explorer

    Not applicable. Use this ribbon ID to return XML markup for explorer ribbons, context menus, and Backstage view.

    Explorer

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    When Outlook 2010 starts, it calls the GetCustomUI method of the IRibbonExtensibility interface and specifies the ribbon ID in the RibbonID parameter for the add-in. The add-in should implement the GetCustomUI method such that if RibbonID is Microsoft.Outlook.Explorer, GetCustomUI returns the XML markup for explorer and context menu customizations.

    XML Markup Example

     
      
    <ribbon>
        <tabs>
            <tab id="MyTab"
                getVisible="MyTab_GetVisible"
                label="MyTab">
                <group label="MyGroup" id="MyGroup">
                    <button id="MyButton"
                        size="large"
                        label="MyButton"
                        imageMso="HappyFace"
                        onAction="OnMyButtonClick"/>
                </group>
            </tab>
        </tabs>
    </ribbon>
    
    

    User Interface Example

    Figure 1. Extending the explorer ribbon

    Extending the explorer ribbon

    Inspector

     

    Ribbon ID

    Outlook supports different ribbons in inspectors that display different item types. Depending on the message class of the item to be displayed in an inspector, the add-in should expect Outlook to pass the corresponding ribbon ID as the RibbonID parameter to the GetCustomUI method.

    Table 2. Ribbon IDs and Message Class

    Ribbon ID

    Message Class

    Microsoft.OMS.MMS.Compose

    IPM.Note.Mobile.MMS.*

    Microsoft.OMS.MMS.Read

    IPM.Note.Mobile.MMS.*

    Microsoft.OMS.SMS.Compose

    IPM.Note.Mobile.SMS.*

    Microsoft.OMS.SMS.Read

    IPM.Note.Mobile.SMS.*

    Microsoft.Outlook.Appointment

    IPM.Appointment.*

    Microsoft.Outlook.Contact

    IPM.Contact.*

    Microsoft.Outlook.DistributionList

    IPM.DistList.*

    Microsoft.Outlook.Journal

    IPM.Activity.*

    Microsoft.Outlook.Mail.Compose

    IPM.Note.*

    Microsoft.Outlook.Mail.Read

    IPM.Note.*

    Microsoft.Outlook.MeetingRequest.Read

    IPM.Schedule.Meeting.Request or IPM.Schedule.Meeting.Canceled

    Microsoft.Outlook.MeetingRequest.Send

    IPM.Schedule.Meeting.Request

    Microsoft.Outlook.Post.Compose

    IPM.Post.*

    Microsoft.Outlook.Post.Read

    IPM.Post.*

    Microsoft.Outlook.Report

    IPM.Report.*

    Microsoft.Outlook.Resend

    IPM.Resend.*

    Microsoft.Outlook.Response.Compose

    IPM.Schedule.Meeting.Resp.*

    Microsoft.Outlook.Response.CounterPropose

    IPM.Schedule.Meeting.Resp.*

    Microsoft.Outlook.Response.Read

    IPM.Schedule.Meeting.Resp.*

    Microsoft.Outlook.RSS

    IPM.Post.Rss.*

    Microsoft.Outlook.Sharing.Compose

    IPM.Sharing.*

    Microsoft.Outlook.Sharing.Read

    IPM.Sharing.*

    Microsoft.Outlook.Task

    IPM.Task.* and IPM.TaskRequest.*

    IRibbonControl.Context

    Inspector object

    Remarks

    When Outlook 2010 displays the first inspector for a built-in message class, Outlook calls the GetCustomUI method of the IRibbonExtensibility interface and specifies the ribbon ID in the RibbonID parameter for the add-in. The add-in should implement the GetCustomUI method such that GetCustomUI returns the appropriate XML markup based on RibbonID.

    Use the CurrentItem property of the Inspector object to return the item-level object such as MailItemAppointmentItemContactItem, or TaskItem.

    XML Markup Example

     
      
    <ribbon>
        <tabs>
            <tab id="MyTab"
                getVisible="MyTab_GetVisible"
                label="MyTab">
                <group label="MyGroup" id="MyGroup" >
                    <button id="MyButton"
                        size="large"
                        label="MyButton"
                        imageMso="HappyFace"
                        onAction="OnMyButtonClick"/>
                </group>
            </tab>
        </tabs>
    </ribbon>
    
    

    User Interface Example

    Figure 2. Extending the inspector ribbon

    Extending the inspector ribbon

    Folder Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Folder object

    Remarks

    When Outlook 2010 displays the following context menu, a folder is selected in the Folder List in the Navigation Pane.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuFolder">
            <button id="MyContextMenuFolder"
                label="ContextMenuFolder"
                onAction="OnMyButtonClick" />
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 3. Extending the context menu for a folder in the Folder List

    Extending the context menu for a folder

    Root Search Folder Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Folder object

    Remarks

    When Outlook 2010 displays the following context menu, the root search folder, Search Folders, is selected in the Folder List in the Navigation Pane.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuSearchRoot">
            <button id="MyContextMenuSearchRoot"
                label="ContextMenuSearchRoot"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 4. Extending the context menu for the root search folder

    Extending the context menu for root search folder

    Store Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Store object

    Remarks

    When Outlook 2010 displays the following context menu, a store folder is selected in the Folder List in the Navigation Pane.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuStore">
            <button id="MyContextMenuStore"
                label="ContextMenuStore"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 5. Extending the context menu for a store folder

    Extending the context menu for a store folder

    Context Menu for a Mail Item

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Selection object

    Remarks

    When Outlook 2010 displays the following context menu, a mail item is selected in the current view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuMailItem">
            <button id="MyContextMenuMailItem"
                label="ContextMenuMailItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 6. Extending the context menu for a mail item

    Extending the context menu for a mail item

    Context Menu for Multiple Selected Items

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Selection object

    Remarks

    When Outlook 2010 displays the following context menu, multiple items are selected in the current view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuMultipleItems">
            <button id="MyContextMenuMultipleItems"
                label="ContextMenuMultipleItems"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 7. Extending the context menu for multiple selected items

    Extending context menu for multiple selected items

    Context Menu for an Appointment or Meeting Request

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Selection object

    Remarks

    When Outlook 2010 displays the following context menu, an appointment or a meeting request is selected in the current calendar view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuCalendarItem">
            <button id="MyContextMenuCalendarItem"
                label="ContextMenuCalendarItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 8. Extending the context menu for a meeting request in the meeting organizer's calendar

    Extending the context menu for a meeting request

    Context Menu for a Task Item

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Selection object

    Remarks

    When Outlook 2010 displays the following context menu, a task item is selected in the current task view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuTaskItem">
            <button id="MyContextMenuTaskItem"
                label="ContextMenuTaskItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 9. Extending the context menu for a task item

    Extending the content menu for a task item

    Context Menu for a Contact Item

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Selection object

    Remarks

    When Outlook 2010 displays the following context menu, a contact item is selected in the current view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuContactItem">
            <button id="MyContextMenuContactItem"
                label="ContextMenuContactItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 10. Extending the context menu for a contact item

    Extending the context menu for a contact item

    Context Menu for a Journal Item

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Selection object

    Remarks

    When Outlook 2010 displays the following context menu, a journal item is selected in the current view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuJournalItem">
            <button id="MyContextMenuJournalItem" 
                label="ContextMenuJournalItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 11. Extending the context menu for a journal item

    Extending the context menu for a journal item

    Context Menu for a Note Item

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Selection object

    Remarks

    When Outlook 2010 displays the following context menu, a note item is selected in the current view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuNoteItem">
            <button id="MyContextMenuNoteItem"
                label="ContextMenuNoteItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 12. Extending the content menu for a note item

    Extending the context menu for a note item

    Shortcut Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Remarks

    When Outlook 2010 displays the following context menu, a shortcut is selected in the Shortcuts module.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuShortcut">
            <button id="MyContextMenuShortcut"
                label="ContextMenuShortcut"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 13. Extending the context menu for a shortcut in the Shortcuts module

    Extending the context menu for a shortcut

    Attachment Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Remarks

    When Outlook 2010 displays the following context menu, one or more attachments are selected in the Reading Pane in the explorer, or in an inspector.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuAttachments">
            <button id="MyContextMenuAttachments"
                label="ContextMenuAttachments"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 14. Extending the context menu for an attachment or attachments in the Reading Pane

    Extending the context menu for attachments

    Table View Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    View object

    Remarks

    Outlook 2010 displays the following context menu when a user displays the context menu in a table view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuTableView">
            <button id="MyContextMenuTableView"
                label="ContextMenuTableView"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 15. Extending the context menu in a table view

    Extending the context menu in a table view

    Calendar View Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    View object

    Remarks

    Outlook 2010 displays the following context menu when a user displays the context menu in a calendar view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuCalendarView">
            <button id="MyContextMenuCalendarView" 
                label="ContextMenuCalendarView" 
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 16. Extending the context menu in a calendar view

    Extending the context menu in a calendar view

    Card View Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    View object

    Remarks

    Outlook 2010 displays the following context menu when a user displays the context menu in a card view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuCardView">
            <button id="MyContextMenuCardView" 
                label="ContextMenuCardView" 
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 17. Extending the context menu in a card view

    Extending the context menu in a card view

    Timeline View Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    View object

    Remarks

    Outlook 2010 displays the following context menu when a user displays the context menu in a timeline view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuTimelineView">
            <button id="MyContextMenuTimelineView" 
                label="ContextMenuTimelineView" 
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 18. Extending the context menu in a timeline view

    Extending the context menu in a timeline view

    Menu for the Arrange By Command

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following menu when a user points to Arrange By in the context menu for a field in a table view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuTableArrangeBy">
            <button id="MyContextMenuTableArrangeBy" 
                label="ContextMenuTableArrangeBy" 
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 19. Extending the Arrange By menu in a table view

    Extending the Arrange By menu in a table view

    Context Menu for Time Bar

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following context menu when a user right-clicks the time bar in a calendar view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuCalendarViewTimeBar">
            <button id="MyContextMenuCalendarViewTimeBar" 
                label="ContextMenuCalendarViewTimeBar" 
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 20. Extending the context menu for the time bar in a calendar view

    Extending the context menu for the time bar

    Context Menu for Free/Busy Bar

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following context menu when a user right-clicks the free/busy bar in a calendar view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuCalendarViewFreeBusyBar">
            <button id="MyContextMenuCalendarViewFreeBusyBar" 
                label="ContextMenuCalendarViewFreeBusyBar" 
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 21. Extending the context menu for the free/busy bar in a calendar view

    Extending the context menu for the free/busy bar

    Context Menu for a Table View Column

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following context menu when a user right-clicks a column header in a table view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuTableViewColumn">
            <button id="MyContextMenuTableViewColumn" 
                label="ContextMenuTableViewColumn" 
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 22. Extending the context menu for a column in a table view

    Extending the context menu for a table view column

    Categories Context Menu

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following context menu when a user right-clicks a category or, if no category has been specified, the user right-clicks under the Category column in a table view.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuCategories">
            <button id="MyContextMenuCategories"
                label="ContextMenuCategories"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 23. Extending the context menu for a category

    Extending the context menu for a category

    Context Menu for Quick Flags

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following context menu when a user displays the context menu for a quick flag.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuQuickFlags">
            <button id="MyContextMenuQuickFlags"
                label="ContextMenuQuickFlags"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 24. Extending the context menu for quick flags

    Extending the context menu for quick flags

    Context Menu for Flagged Mail Item

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following context menu when a user displays the context menu for a flagged mail item in the To-Do Bar.

    XML Markup Example

     
    <contextMenus>    
        <contextMenu idMso="ContextMenuFlaggedMailItem">
            <button id="MyContextMenuFlaggedMailItem"
                label="ContextMenuFlaggedMailItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>
    </contextMenus>
    
    

    User Interface Example

    Figure 25. Extending the context menu for a flagged mail item

    Extending the context menu for a flagged mail item

    Context Menu for Flagged Contact Item

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following context menu when a user displays the context menu for a flagged mail item in the To-Do Bar.

    XML Markup Example

     
    <contextMenus>    
        <contextMenu idMso="ContextMenuFlaggedContactItem">
            <button id="MyContextMenuFlaggedContactItem"
                label="ContextMenuFlaggedContactItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>
    </contextMenus>
    
    

    User Interface Example

    Figure 26. Extending the context menu for a flagged contact item

    Extending context menu for a flagged contact item

    New Items Menu for Mail Module

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following menu when a user selects New Items in the Home tab of the explorer ribbon for the Mail module. Although the New Items menu is not a context menu, the markup for a custom menu item should be placed inside the <contextMenus></contextMenus> tags. That way, you can add a command for an item that is based on a custom message class to the built-in New Itemsmenu.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="MenuMailNewItem">
            <button id="MyMenuMailNewItem"
                label="MenuNewMailItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 27. Extending the New Items menu for the Mail module

    Extending the New Items menu for the Mail module

    New Items Menu for Calendar Module

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following menu when a user clicks New Items in the Home tab of the explorer ribbon for the Calendar module. Although the New Items menu is not a context menu, the markup for a custom menu item should be placed inside the <contextMenus></contextMenus> tags. That way, you can add a command for an item that is based on a custom message class to the built-in New Itemsmenu.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="MenuCalendarNewItem">
            <button id="MyMenuCalendarNewItem"
                label="MenuCalendarNewItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 28. Extending the New Items menu for the Calendar module

    Extending New Items menu for Calendar module

    New Items Menu for Contacts Module

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following menu when a user clicks New Items in the Home tab of the explorer ribbon for the Contacts module. Although the New Items menu is not a context menu, the markup for a custom menu item should be placed inside the <contextMenus></contextMenus> tags. That way, you can add a command for an item that is based on a custom message class to the built-in New Itemsmenu.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="MenuContactsNewItem">
            <button id="MyMenuContactsNewItem"
                label="MenuContactsNewItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 29. Extending the New Items menu for the Contacts module

    Extending New Items menu for Contacts module

    New Items Menu for Tasks Module

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following menu when a user clicks New Items in the Home tab of the explorer ribbon for the Tasks module. Although the New Items menu is not a context menu, the markup for a custom menu item should be placed inside the <contextMenus></contextMenus> tags. That way, you can add a command for an item that is based on a custom message class to the built-in New Itemsmenu.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="MenuTasksNewItem">
            <button id="MyMenuTasksNewItem"
                label="MenuTasksNewItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 30. Extending the New Items menu for the Tasks module

    Extending the New Items menu for the Tasks module

    New Items Menu for Journal Module

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following menu when a user clicks New Items in the Home tab of the explorer ribbon for the Journal module. Although the New Items menu is not a context menu, the markup for a custom menu item should be placed inside the <contextMenus></contextMenus> tags. That way, you can add a command for an item that is based on a custom message class to the built-in New Itemsmenu.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="MenuJournalNewItem">
            <button id="MyMenuJournalNewItem"
                label="MenuJournalNewItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 31. Extending the New Items menu for the Journal module

    Extending New Items menu for Journal module

    New Items Menu for Notes Module

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object

    Remarks

    Outlook 2010 displays the following menu when a user clicks New Items in the Home tab of the explorer ribbon for the Notes module. Although the New Items menu is not a context menu, the markup for a custom menu item should be placed inside the <contextMenus></contextMenus> tags. That way, you can add a command for an item that is based on a custom message class to the built-in New Itemsmenu.

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="MenuNotesNewItem">
            <button id="MyMenuNotesNewItem"
                label="MenuNotesNewItem"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 32. Extending the New Items menu for the Notes module

    Extending the New Items menu for the Notes module

    Persona Context Menu for a Sender or Recipient

     

    Ribbon ID

    Microsoft.Mso.IMLayerUI

    IRibbonControl.Context

    Office.IMsoContactCard object

    Remarks

    Outlook 2010 displays the persona context menu when a user right-clicks a sender or a recipient of an Outlook item. To determine the identity of the sender or recipient, use the Address property of the IMsoContactCard object in the Office object model to obtain an AddressEntry object in the Outlook object model, which represents the recipient as shown in the following code example.

     
    if (control.Context is Microsoft.Office.Core.IMsoContactCard)
    {
        msg = "Context=IMsoContactCard" + "
    ";
        Office.IMsoContactCard card = control.Context as Office.IMsoContactCard;
        Outlook.AddressEntry addr =
            Globals.ThisAddIn.Application.Session.GetAddressEntryFromID(
            card.Address);
        if (addr != null)
        {
            msg = msg + addr.Name;
        }
        MessageBox.Show(msg);
    }
    
    

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuContactCardRecipient">
            <button id="MyContextMenuContactCardRecipient"
                label="ContextMenuContactCardRecipient"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 33. Extending the persona context menu for a recipient

    Extending the persona context menu

    Menu for Alternative Interactions

     

    Ribbon ID

    Microsoft.Mso.IMLayerUI

    IRibbonControl.Context

    Office.IMsoContactCard object

    Remarks

    To interact with a contact by using a way other than e-mail, instant message, or phone, a user can specify an alternative form on the shortcut menu that is on a Contact Card. To display a Contact Card, a user can rest the pointer on, click, or right-click a sender or recipient of an Outlook item.

    To determine the identity of the sender or recipient, use the Address property of the IMsoContactCard object in the Office object model to obtain an AddressEntry object in the Outlook object model, which represents the recipient as shown in the following code example.

     
    if (control.Context is Microsoft.Office.Core.IMsoContactCard)
    {
        msg = "Context=IMsoContactCard" + "
    ";
        Office.IMsoContactCard card = control.Context as Office.IMsoContactCard;
        Outlook.AddressEntry addr =
            Globals.ThisAddIn.Application.Session.GetAddressEntryFromID
            (card.Address);
        if (addr != null)
        {
            msg = msg + addr.Name;
        }
        MessageBox.Show(msg);
    }
    
    

    XML Markup Example

     
      
    <contextMenus>    
        <contextMenu idMso="ContextMenuContactCardOverflowDropdown">
            <button id="MyContextMenuContactCardOverflow"
                label="ContextMenuContactCardOverflow"
                onAction="OnMyButtonClick"/>
        </contextMenu>  
    </contextMenus>
    
    

    User Interface Example

    Figure 34. Extending the other-interaction menu for a contact

    Extending the other-interaction menu for a contact

    Contextual Tabs

     

    Ribbon ID

    Microsoft.Outlook.Explorer or appropriate Inspector RibbonID

    IRibbonControl.Context

    Explorer object or Inspector object

    Remarks

    Contextual tabs appear when a user selects an object in the Outlook user interface with the intent to edit or modify that object. Customizing a contextual tab is similar to customizing a built-in ribbon tab, but the markup for customization uses <contextualTabs></contextualTabs> tags instead of <tabs></tabs>. Contextual tabs are used extensively in Outlook 2010. The following example shows how to customize the contextual tab for attachments named Attachment Tools.The Attachment Context Menu described previously adds a context menu item that can act on the selected attachment. To create an equivalent command in the Attachment Tools contextual tab, you need to supply XML markup as shown in the following XML markup example and then determine the selected attachment by using the AttachmentSelection object returned by IRibbonControl.Context as shown in the following C# code fragment:

     
        else if (control.Context is Outlook.Explorer)
        {
            msg = "Context=Explorer" + "
    ";
            Outlook.Explorer explorer = 
                control.Context as Outlook.Explorer;
                if (explorer.AttachmentSelection.Count >= 1)
                {
                    Outlook.AttachmentSelection attachSel =
                        explorer.AttachmentSelection;
                    foreach (Outlook.Attachment attach in attachSel)
                    {
                        msg = msg + attach.DisplayName + "
    ";
                    }
                }
                else
                {
                    Outlook.Selection selection =
                        explorer.Selection;
                    if (selection.Count == 1)
                    {
                        OutlookItem olItem =
                            new OutlookItem(selection[1]);
                        msg = msg + olItem.Subject
                            + "
    " + olItem.LastModificationTime;
                    }
                    else
                    {
                        msg = msg + "Multiple Selection Count="
                            + selection.Count;
                    }
                }
            }
        }    
    
    

    XML Markup Example

     
    <contextualTabs>
        <tabSet idMso="TabSetAttachments">
            <tab idMso="TabAttachments">
                <group label="MyGroup" id="MyAttachmentGroup">
                    <button id="MyButtonAttachments"
                        size="large"
                        label="MyButtonAttachments"
                        imageMso="HappyFace"
                        onAction="OnMyButtonClick" />
                </group>
            </tab>
        </tabSet>
    </contextualTabs>
    
    

    User Interface Example

    Figure 35. Extending the Attachments tab with an Attachment Tools contextual tab for an Outlook explorer

    Extending the Attachments tab

    Backstage View

     

    Ribbon ID

    Microsoft.Outlook.Explorer

    IRibbonControl.Context

    Explorer object or Inspector object

    Remarks

    Backstage view helps users to find commonly used features and to discover new ways to work with their documents. To access Backstage view, click the File tab that appears to the left of the Home tab. In Outlook 2010, you can use Backstage view to expose application-level settings for an add-in. Consider customizing Backstage view to replace the property page extensions that were accessible when you clicked Tools and then Options in earlier versions of Outlook. Property page extensions continue to work in Outlook 2010, but users might not find them easily. To access add-in property page extensions, open Backstage view, click the Options command to display the Outlook Options dialog box, click the Add-ins tab, and then click the Add-in Options button.

    Outlook 2010 can display Backstage view in either an explorer or inspector window. Use the IRibbonControl.Context property to determine whether Backstage view is hosted in an explorer or inspector window.

    A tab in Backstage view is a functional unit. Backstage view contains default tabs. For example, Backstage view for the Outlook explorer contains the Info, Open, Print, and Help tabs. If you want to create a custom tab and show it in only an Outlook explorer or inspector window, use the GetVisible callback. The following C# code example causes the MyPlace tab to be visible only in the explorer window.

     
    public bool MyPlace_GetVisible(IRibbonControl control)
    {
        if (control.Context is Microsoft.Office.Interop.Outlook.Explorer)
            return true;
        else
            return false;
    }
    
    

    XML Markup Example

     
    <backStage>
        <tab id="MyBackStageTab"
            label="MyTab"
            getVisible="MyBackStageTab_GetVisible">
            <firstColumn>
                <group id="regularGroup"
                    label="My Regular Group"
                    helperText="My Regular Group Helper Text">
                    <primaryItem>
                        <button id="MyHeroButton"
                            label="My Hero Button"
                            imageMso="MagicEightBall"
                            isDefinitive="false"
                            onAction="OnMyButtonClick"
                            screentip="Click to spin the magic eight ball."/>
                    </primaryItem>
                    <bottomItems>
                        <hyperlink
                            id="hyperlink"
                            label="Office Developer Center"
                            target="http://msdn.microsoft.com/en-us/office/default.aspx"/>
                        <imageControl id="userImage"
                            getImage="GetCurrentUserImage"/>
                        <layoutContainer id="vertical"
                            align="left"
                            layoutChildren="vertical">
                            <labelControl id="labelControl2" 
                                label="Vertical layout"/>
                            <radioGroup id="myradiogroup1" label="Options">
                                <radioButton id="rb1" label="Option 1"/>
                                <radioButton id="rb2" label="Option 2"/>
                                <radioButton id="rb3" label="Option 3"/>
                            </radioGroup>
                        </layoutContainer>
                        <groupBox id="mygroupbox1" label="Check Boxes">
                            <checkBox id="check1" label="Check Box 1"/>
                            <checkBox id="check2" label="Check Box 2"/>
                            <checkBox id="check3" label="Check Box 3"/>
                        </groupBox>
                        <layoutContainer id="vertical2"
                            align="left"
                            layoutChildren="vertical">
                            <comboBox id="comboBox" label="Color ComboBox">
                                <item id="cbi1" label="Blue"/>
                                <item id="cbi2" label="Magenta"/>
                                <item id="cbi3" label="Cyan"/>
                            </comboBox>
                        </layoutContainer>
                    </bottomItems>
                </group>
                <taskGroup id="taskGroup"
                    label="My Task Group"
                    helperText="My Task Group Helper Text">
                    <category id="MyCategory" label="My Category">
                    <task id="MyTask"
                        tag="MyTask"
                        isDefinitive="true"
                        label="My Task"
                        imageMso="NewTask"/>
                    </category>
                </taskGroup>
            </firstColumn>
            <secondColumn>
                <group id="myemptygroup">
                </group>
            </secondColumn>
        </tab>
    </backstage>
    
    

    User Interface Example

    Figure 36. Extending Backstage view for an Outlook explorer

    Extending Backstage view for an Outlook explorer

    Conclusion

     

    In the 2007 Microsoft Office system, the Fluent UI includes the ribbon, menus, enhanced screen tips, a Mini toolbar, and keyboard shortcuts that appear in various Office applications. Office 2010 adds Backstage view to the Fluent UI. Fluent UI extensibility supports the ability to customize Fluent UI components programmatically. For example, Outlook 2010 provides many ways to extend the ribbon in an explorer or inspector, the menus, the context menus, and Backstage view. The principles behind programmatic extensions to the Fluent UI are all very similar; all involve using IRibbonExtensibility.GetCustomUI to specify XML markup for the custom UI and writing callbacks in an add-in to respond to user actions on the custom UI. The consistent extensibility design makes it easier for Outlook 2010 add-in developers to further enhance their UI.

    Additional Resources

     
  • 相关阅读:
    基础面试
    三级联动
    数据库分裤分表操作
    缓存的三种方式
    php部分--session的三种用法
    css
    数组
    生成中国地区随机IP
    xml的读取
    React入门
  • 原文地址:https://www.cnblogs.com/freeliver54/p/8934265.html
Copyright © 2020-2023  润新知