【问题标题】:Outlook VSTO AddIn / Custom Ribbon: How to add custom Ribbon to home group (Main Window) in Outlook 2016Outlook VSTO 插件/自定义功能区:如何在 Outlook 2016 中将自定义功能区添加到家庭组(主窗口)
【发布时间】:2020-05-06 04:32:42
【问题描述】:

我尝试将以下自定义功能区(设计器方法)添加到 Outlook(资源管理器)中的 TabHomeGroup。不幸的是它不会出现。为什么?

我使用了这些 OfficeId:https://www.microsoft.com/en-us/download/details.aspx?id=50745

namespace OutlookAddIn4
{

partial class Ribbon_Explorer : Microsoft.Office.Tools.Ribbon.RibbonBase
{
    /// <summary>
    /// Erforderliche Designervariable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    public Ribbon_Explorer()
        : base(Globals.Factory.GetRibbonFactory())
    {
        InitializeComponent();
    }

    /// <summary> 
    /// Verwendete Ressourcen bereinigen.
    /// </summary>
    /// <param name="disposing">"true", wenn verwaltete Ressourcen gelöscht werden sollen, andernfalls "false".</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Vom Komponenten-Designer generierter Code

    /// <summary>
    /// Erforderliche Methode für die Designerunterstützung.
    /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
    /// </summary>
    private void InitializeComponent()
    {
        this.tab1 = this.Factory.CreateRibbonTab();
        this.group1 = this.Factory.CreateRibbonGroup();
        this.btnSettings = this.Factory.CreateRibbonButton();
        this.tab1.SuspendLayout();
        this.group1.SuspendLayout();
        this.SuspendLayout();
        // 
        // tab1
        // 
        this.tab1.ControlId.ControlIdType = Microsoft.Office.Tools.Ribbon.RibbonControlIdType.Office;
        this.tab1.ControlId.OfficeId = "TabHomeGroup";
        this.tab1.Groups.Add(this.group1);
        this.tab1.Label = "TabHomeGroup";
        this.tab1.Name = "tab1";
        // 
        // group1
        // 
        this.group1.Items.Add(this.btnSettings);
        this.group1.Label = "group1";
        this.group1.Name = "group1";
        // 
        // btnSettings
        // 
        this.btnSettings.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
        this.btnSettings.Image = global::OutlookAddIn4.Properties.Resources.do_48x48;
        this.btnSettings.Label = "Settings";
        this.btnSettings.Name = "btnSettings";
        this.btnSettings.ShowImage = true;
        this.btnSettings.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btnSettings_Click);
        // 
        // Ribbon_Explorer
        // 
        this.Name = "Ribbon_Explorer";
        this.RibbonType = "Microsoft.Outlook.Explorer";
        this.Tabs.Add(this.tab1);
        this.Load += new Microsoft.Office.Tools.Ribbon.RibbonUIEventHandler(this.Ribbon_Explorer_Load);
        this.tab1.ResumeLayout(false);
        this.tab1.PerformLayout();
        this.group1.ResumeLayout(false);
        this.group1.PerformLayout();
        this.ResumeLayout(false);

    }

    #endregion

    internal Microsoft.Office.Tools.Ribbon.RibbonTab tab1;
    internal Microsoft.Office.Tools.Ribbon.RibbonGroup group1;
    internal Microsoft.Office.Tools.Ribbon.RibbonButton btnSettings;
    internal SettingsForm settingsForm;
}

partial class ThisRibbonCollection
{
    internal Ribbon_Explorer Ribbon_Explorer
    {
        get { return this.GetRibbon<Ribbon_Explorer>(); }
    }
}

}

【问题讨论】:

    标签: outlook-addin ribbon


    【解决方案1】:

    您确定在您的加载项启动时TabHomeGroup 可见吗?

    无论如何,如果您想将自定义 UI 放置在资源管理器窗口的 Home 选项卡上,则需要使用 TabHome idMso。

    【讨论】:

    • 我认为 TabHome 总是可见的。此外,我认为 Outlook 总是以 TabMail 开头。我使用 Designer 而不是 XML 方法。所以据我了解,这种方法只能使用 XML 方法,对吧?
    • 您也可以使用设计器,只需指定TabHome 而不是TabHomeGroup
    猜你喜欢
    • 2012-05-07
    • 1970-01-01
    • 2018-07-01
    • 1970-01-01
    • 2018-08-29
    • 1970-01-01
    • 1970-01-01
    • 2015-07-28
    • 2020-08-15
    相关资源
    最近更新 更多