我创建了一个Outlook 2016加载项,它使用功能区设计器在检查器窗口中完美地显示约会。根据documentation的说法,我添加了RibbonType Microsoft.Outlook.Explorer。
我本以为它也会出现在Outlook的开始屏幕上:

此外,我找不到任何合适的RibbonType设置,以便插件显示在开始屏幕上。我应该添加哪一个?

在哪里可以找到有关如何自定义Outlook功能区的附加文档?我必须切换到XML定制吗?有没有关于如何从Designer迁移到XML的文档?
我还包含了Designer代码:
namespace OutlookAddIn4
{
partial class MyAddIn : Microsoft.Office.Tools.Ribbon.RibbonBase
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
public MyAddIn()
: 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 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.btnAddMyAddIn = this.Factory.CreateRibbonButton();
this.btnViewInMyAddIn = this.Factory.CreateRibbonButton();
this.btnRemoveFromMyAddIn = this.Factory.CreateRibbonButton();
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 = "TabAppointment";
this.tab1.Groups.Add(this.group1);
this.tab1.Label = "TabAppointment";
this.tab1.Name = "tab1";
//
// group1
//
this.group1.Items.Add(this.btnAddMyAddIn);
this.group1.Items.Add(this.btnViewInMyAddIn);
this.group1.Items.Add(this.btnRemoveFromMyAddIn);
this.group1.Items.Add(this.btnSettings);
this.group1.Label = "MyAddIn";
this.group1.Name = "group1";
this.group1.Position = this.Factory.RibbonPosition.AfterOfficeId("GroupActions");
//
// btnAddMyAddIn
//
this.btnAddMyAddIn.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnAddMyAddIn.Image = global::OutlookAddIn4.Properties.Resources.do_48x48;
this.btnAddMyAddIn.Label = "Add Minutes";
this.btnAddMyAddIn.Name = "btnAddMyAddIn";
this.btnAddMyAddIn.ShowImage = true;
this.btnAddMyAddIn.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.BtnAddMyAddIn_Click);
//
// btnViewInMyAddIn
//
this.btnViewInMyAddIn.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnViewInMyAddIn.Image = global::OutlookAddIn4.Properties.Resources.do_48x48;
this.btnViewInMyAddIn.Label = "View Minutes";
this.btnViewInMyAddIn.Name = "btnViewInMyAddIn";
this.btnViewInMyAddIn.ShowImage = true;
this.btnViewInMyAddIn.Visible = false;
this.btnViewInMyAddIn.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.ViewInMyAddIn_Click);
//
// btnRemoveFromMyAddIn
//
this.btnRemoveFromMyAddIn.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnRemoveFromMyAddIn.Image = global::OutlookAddIn4.Properties.Resources.do_48x48;
this.btnRemoveFromMyAddIn.Label = "Remove Minutes";
this.btnRemoveFromMyAddIn.Name = "btnRemoveFromMyAddIn";
this.btnRemoveFromMyAddIn.ShowImage = true;
this.btnRemoveFromMyAddIn.Visible = false;
this.btnRemoveFromMyAddIn.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.RemoveFromMyAddIn_Click);
//
// 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.Settings_Click);
//
// MyAddIn
//
this.Name = "MyAddIn";
this.RibbonType = "Microsoft.Outlook.Appointment, Microsoft.Outlook.Explorer";
this.StartFromScratch = true;
this.Tabs.Add(this.tab1);
this.Load += new Microsoft.Office.Tools.Ribbon.RibbonUIEventHandler(this.MyAddIn_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 btnAddMyAddIn;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnViewInMyAddIn;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnRemoveFromMyAddIn;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnSettings;
internal SettingsForm settingsForm;
}
partial class ThisRibbonCollection
{
internal MyAddIn MyAddIn
{
get { return this.GetRibbon<MyAddIn>(); }
}
}
}发布于 2020-05-01 15:21:39
我有点傻。RibbonType只是一个粗略的预选区域,其中您的插件是可见的。为了精确地定义添加功能区的区域,您还需要定义选项卡的OfficeId,如下所示: this.tab1.ControlId.OfficeId = " TabAppointment ";从上面的示例代码中,您可以看到它被设置为TabAppointment。
要查找其他有效的选项卡,您可能会发现以下list很有帮助
由此我得出结论:如果你想在多个窗口(例如,主窗口、日历和约会)中显示你的自定义功能区,你需要将多个功能区连接到不同的OfficeIds上。
发布于 2020-05-04 15:43:03
功能区(可视设计器)项不支持所有可能的功能区自定义类型。若要以高级方式自定义功能区,可以将功能区从设计器导出为ribbon XML,然后直接编辑XML。How to: Export a ribbon from the Ribbon Designer to Ribbon XML文章详细描述了这项任务,因此您可以继续使用XML语言和Fluent UI提供的所有特性。
Fluent UI (也称为Ribbon UI)将在以下系列文章中进行深入介绍:
https://stackoverflow.com/questions/61538076
复制相似问题