在Outlook新项目旁边显示Outlook加载项

时间:2019-03-14 11:44:27

标签: outlook outlook-addin outlook-2016

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

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

为更好地理解,请参见图像。我需要在黄色位置添加精确的数字。

代码段

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;

enter image description here

1 个答案:

答案 0 :(得分: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中获得以下图片:

Outlook 2013 with a custom ribbon controls on a built-in tab

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