【问题标题】:Display Outlook Add-ins next to new items of Outlook在 Outlook 的新项目旁边显示 Outlook 加载项
【发布时间】:2019-08-05 07:09:31
【问题描述】:

我创建了一个 Outlook 加载项,它按预期工作。新安装的加载项显示在 Outlook 的“主页”选项卡中。它显示为一个新组。

我需要我的加载项显示在 Outlook 中的新项目选项旁边。

为了更好地理解,请查看图片。我需要在黄色位置添加确切的内容。

代码sn-p

private void InitializeComponent() {
        this.tabCustomHome = this.Factory.CreateRibbonTab();
        this.group1 = this.Factory.CreateRibbonGroup();
        this.menuButton1 = this.Factory.CreateRibbonMenu();
        this.btnLogin = this.Factory.CreateRibbonButton();
        this.btnLogout = this.Factory.CreateRibbonButton();
        this.tabCustomHome.SuspendLayout();
        this.group1.SuspendLayout();
        this.SuspendLayout();
        // 
        // tabCustomHome
        // 
        this.tabCustomHome.ControlId.ControlIdType = Microsoft.Office.Tools.Ribbon.RibbonControlIdType.Office;
        this.tabCustomHome.ControlId.OfficeId = "TabMail";
        this.tabCustomHome.Groups.Add(this.group1);
        this.tabCustomHome.Label = "TabMail";
        this.tabCustomHome.Name = "tabCustomHome";
        // 
        // group1
        // 
        this.group1.Items.Add(this.menuButton1);
        this.group1.Label = "Sample";
        this.group1.Name = "group1";
        // 
        // menuButton1
        // 
        this.menuButton1.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
        this.menuButton1.Dynamic = true;
        this.menuButton1.Image = global::SHOutlookLogin.Properties.Resources.Sales;
        this.menuButton1.Label = " ";
        this.menuButton1.Name = "menuButton1";
        this.menuButton1.ShowImage = true;
        // 
        // btnLogin
        // 
        this.btnLogin.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
        this.btnLogin.Label = "Login";
        this.btnLogin.Name = "btnLogin";
        this.btnLogin.ShowImage = true;
        this.btnLogin.Click += BtnLogin_Click;
        // 
        // btnLogout
        // 
        this.btnLogout.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
        this.btnLogout.Label = "Logout";
        this.btnLogout.Name = "btnLogout";
        this.btnLogout.ShowImage = true;
        this.btnLogout.Click += BtnLogout_Click;
        // 
        // OutlookLoginRibbon
        // 
        this.Name = "OutlookLoginRibbon";
        this.RibbonType = "Microsoft.Outlook.Explorer";
        this.Tabs.Add(this.tabCustomHome);
        this.Load += new Microsoft.Office.Tools.Ribbon.RibbonUIEventHandler(this.OutlookLoginRibbon_Load);
        this.tabCustomHome.ResumeLayout(false);
        this.tabCustomHome.PerformLayout();
        this.group1.ResumeLayout(false);
        this.group1.PerformLayout();
        this.ResumeLayout(false);

    }



    #endregion

    internal Microsoft.Office.Tools.Ribbon.RibbonTab tabCustomHome;
    internal Microsoft.Office.Tools.Ribbon.RibbonGroup group1;
    internal Microsoft.Office.Tools.Ribbon.RibbonButton btnLogin;
    internal Microsoft.Office.Tools.Ribbon.RibbonButton btnLogout;
    internal Microsoft.Office.Tools.Ribbon.RibbonMenu menuButton1;

【问题讨论】:

    标签: outlook outlook-addin outlook-2016


    【解决方案1】:

    您需要使用以下标记:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="ribbonLoaded_Callback">
      <ribbon startFromScratch="false">
        <tabs>
          <tab getVisible="getVisible_Callback" idMso="TabMail">
            <group getLabel="getLabel_Callback" getScreentip="getScreenTip_Callback" getVisible="getVisible_Callback" id="RibbonGroup_3b56363af4b447adb1126bb6791405c7" insertAfterMso="GroupMailNew">
               <button getDescription="getDescription_Callback" getEnabled="getEnabled_Callback" getKeytip="getKeytip_Callback" getLabel="getLabel_Callback" getScreentip="getScreenTip_Callback" getShowImage="getShowImage_Callback" getShowLabel="getShowLabel_Callback" getSize="getSize_Callback" getVisible="getVisible_Callback" id="RibbonButton_7f2ec50f5d65467fbcf3cadef7e8ab15" onAction="onActionCommon_Callback" />
            </group>
         </tab>
       </tabs>
      </ribbon>
    </customUI>   
    

    因此,您应该在 Outlook 中获得以下图片:

    您可能会发现Walkthrough: Create a custom tab by using Ribbon XML 文章很有帮助。

    【讨论】:

    • 感谢您的更新。我需要 C# 代码中的相同内容。你能帮帮我吗?
    • 只需要在代码中定义GetCustomUI回调即可。其余的回调由您决定。
    • 我添加了一个演练,它提供了使用 C# 示例代码创建功能区选项卡所需的步骤。
    • 我已经添加了我当前的代码。如果没有错,我需要在新项目旁边添加一些显示它的 ID。如果你能帮助我对我的代码进行哪些更改,那就太好了。由于是 Outlook 插件的新手,因此对它不太熟悉。
    • 您可以在上面提供的标记中找到所需的idMso 值。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-07
    • 1970-01-01
    相关资源
    最近更新 更多