ExtensionPoint 元素

定义 Office UI 中加载项公开功能的位置。 <ExtensionPoint> 元素是 AllFormFactorsDesktopFormFactorMobileFormFactor 的子元素。

加载项类型: 任务窗格,邮件

仅在以下 VersionOverrides 架构中有效

  • 任务窗格 1.0
  • 邮件 1.0
  • 邮件 1.1

有关详细信息,请参阅 清单中的版本替代

属性

属性 必需 说明
xsi:type 定义的扩展点类型。 可能的值取决于在祖父 <级 Host 元素值中定义的 Office 主机> 应用程序。

Excel、OneNote、PowerPoint 和 Word 外接程序命令的扩展点

部分或所有这些主机中提供了三种类型的扩展点。

  • PrimaryCommandSurface (适用于 Word、Excel、PowerPoint 和 OneNote) - Office 中的功能区。
  • ContextMenu (适用于 Word、Excel、PowerPoint 和 OneNote) - 在 Office UI 中选择并按住 (或右键单击) 时显示的快捷菜单。
  • CustomFunctions (仅适用于 Excel) - 用 JavaScript for Excel 编写的自定义函数。

有关这些类型的扩展点的子元素和示例,请参阅以下小节。

PrimaryCommandSurface

Word、Excel、PowerPoint 和 OneNote 中的主命令图面是功能区。

子元素

元素 说明
CustomTab 如果要使用 PrimaryCommandSurface) 将自定义选项卡添加到功能区 (,则是必需的。 如果使用 <CustomTab> 元素,则不能使用 <OfficeTab> 元素。 id 属性是必需的。 不能有一个 <以上的 CustomTab> 子元素。
OfficeTab 如果要使用 PrimaryCommandSurface) (扩展默认的 Office 应用功能区选项卡,则是必需的。 如果使用 <OfficeTab> 元素,则不能使用 <CustomTab> 元素。

重要

外接程序中不能有一个具有子< CustomTab> 元素的 ExtensionPoint> 元素;一个 ExtensionPoint 元素只能有一个 CustomTab,因此所有 ExtensionPoint 元素中只有一个 CustomTab 元素。<<><><><>

示例

以下示例演示如何将 <ExtensionPoint> 元素与 PrimaryCommandSurface 配合使用。 它将自定义选项卡添加到功能区。

重要

对于包含 ID 属性的元素,请务必提供唯一的 ID。

<ExtensionPoint xsi:type="PrimaryCommandSurface">
  <CustomTab id="Contoso.MyTab1">
    <Label resid="residLabel4" />
    <Group id="Contoso.Group1">
      <Label resid="residLabel4" />
      <Icon>
        <bt:Image size="16" resid="icon1_32x32" />
        <bt:Image size="32" resid="icon1_32x32" />
        <bt:Image size="80" resid="icon1_32x32" />
      </Icon>
      <Tooltip resid="residToolTip" />
      <Control xsi:type="Button" id="Contoso.Button1">
          <!-- information about the control -->
      </Control>
      <!-- other controls, as needed -->
    </Group>
  </CustomTab>
</ExtensionPoint>

ContextMenu

上下文菜单是在 Office UI 中右键单击时显示的快捷菜单。

子元素

元素 说明
OfficeMenu 如果要使用 ContextMenu) 将加载项命令添加到默认上下文菜单 (,则是必需的。 id 属性必须设置为以下字符串之一:
- ContextMenuText :当用户右键单击所选文本时上下文菜单应打开。
- ContextMenuCell 如果上下文菜单应在用户右键单击 Excel 电子表格上的单元格时打开。

示例

下面向 Excel 电子表格中的单元格添加自定义上下文菜单。

<ExtensionPoint xsi:type="ContextMenu">
  <OfficeMenu id="ContextMenuCell">
    <Control xsi:type="Menu" id="Contoso.ContextMenu2">
            <!-- information about the control -->
    </Control>
    <!-- other controls, as needed -->
  </OfficeMenu>
</ExtensionPoint>

CustomFunctions

用 JavaScript 或 TypeScript for Excel 编写的自定义函数。

子元素

元素 说明
Script 必需。 指向包含自定义函数定义和注册代码的 JavaScript 文件的链接。
Page 必需。 链接到自定义函数的 HTML 页。
必需。 定义 Excel 中的自定义函数所使用的元数据设置。
命名空间 可选。 定义 Excel 中的自定义函数使用的命名空间。

示例

<ExtensionPoint xsi:type="CustomFunctions">
  <Script>
    <SourceLocation resid="Functions.Script.Url"/>
  </Script>
  <Page>
    <SourceLocation resid="Shared.Url"/>
  </Page>
  <Metadata>
    <SourceLocation resid="Functions.Metadata.Url"/>
  </Metadata>
  <Namespace resid="Functions.Namespace"/>
</ExtensionPoint>

仅适用于 Outlook 的扩展点

MessageReadCommandSurface

此扩展点将按钮置于邮件阅读视图的命令界面中。 在 Outlook 桌面,它显示在功能区中。

子元素

元素 说明
OfficeTab 将命令添加到默认功能区选项卡。
CustomTab 将命令添加到自定义功能区选项卡。

OfficeTab 示例

<ExtensionPoint xsi:type="MessageReadCommandSurface">
  <OfficeTab id="TabDefault">
        <-- OfficeTab Definition -->
  </OfficeTab>
</ExtensionPoint>

CustomTab 示例

<ExtensionPoint xsi:type="MessageReadCommandSurface">
  <CustomTab id="Contoso.TabCustom2">
        <-- CustomTab Definition -->
  </CustomTab>
</ExtensionPoint>

MessageComposeCommandSurface

此扩展点将按钮置于使用电子邮件撰写窗体的外接程序的功能区上。

子元素

元素 说明
OfficeTab 将命令添加到默认功能区选项卡。
CustomTab 将命令添加到自定义功能区选项卡。

OfficeTab 示例

<ExtensionPoint xsi:type="MessageComposeCommandSurface">
  <OfficeTab id="TabDefault">
        <-- OfficeTab Definition -->
  </OfficeTab>
</ExtensionPoint>

CustomTab 示例

<ExtensionPoint xsi:type="MessageComposeCommandSurface">
  <CustomTab id="Contoso.TabCustom3">
        <-- CustomTab Definition -->
  </CustomTab>
</ExtensionPoint>

AppointmentOrganizerCommandSurface

此扩展点将按钮置于向会议的组织者显示的窗体的功能区上。

子元素

元素 说明
OfficeTab 将命令添加到默认功能区选项卡。
CustomTab 将命令添加到自定义功能区选项卡。

OfficeTab 示例

<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
  <OfficeTab id="TabDefault">
        <-- OfficeTab Definition -->
  </OfficeTab>
</ExtensionPoint>

CustomTab 示例

<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
  <CustomTab id="Contoso.TabCustom4">
        <-- CustomTab Definition -->
  </CustomTab>
</ExtensionPoint>

AppointmentAttendeeCommandSurface

此扩展点将按钮置于向会议与会者显示的窗体的功能区上。

子元素

元素 说明
OfficeTab 将命令添加到默认功能区选项卡。
CustomTab 将命令添加到自定义功能区选项卡。

OfficeTab 示例

<ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
  <OfficeTab id="TabDefault">
        <-- OfficeTab Definition -->
  </OfficeTab>
</ExtensionPoint>

CustomTab 示例

<ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
  <CustomTab id="Contoso.TabCustom5">
        <-- CustomTab Definition -->
  </CustomTab>
</ExtensionPoint>

Module

此扩展点将按钮置于模块扩展的功能区上。

重要

注册 邮箱项目 事件不适用于此扩展点。

子元素

元素 说明
OfficeTab 将命令添加到默认功能区选项卡。
CustomTab 将命令添加到自定义功能区选项卡。

MobileMessageReadCommandSurface

此扩展点将按钮置于移动外形规格中的邮件阅读视图的命令界面中。

子元素

元素 说明
Group 将按钮组添加到命令界面。

此类型的 ExtensionPoint> 元素只能有一个子元素:Group 元素。<<>

此扩展点中包含的控件>元素必须将 xsi:type 属性设置为 。<MobileButton

示例

<ExtensionPoint xsi:type="MobileMessageReadCommandSurface">
  <Group id="Contoso.mobileGroup1">
    <Label resid="residAppName"/>
    <Control xsi:type="MobileButton" id="Contoso.mobileButton1">
      <!-- Control definition -->
    </Control>
  </Group>
</ExtensionPoint>

MobileOnlineMeetingCommandSurface

此扩展点在移动外形规格的约会的命令图面中放置一个适合模式的开关。 会议组织者可以创建联机会议。 与会者随后可以加入联机会议。 若要了解有关此方案的详细信息,请参阅 为联机会议提供商创建 Outlook 移动加载项

注意

此扩展点仅在具有 Microsoft 365 订阅的 Android 和 iOS 上受支持。

注册 邮箱项目 事件不适用于此扩展点。

子元素

元素 说明
Control 将按钮添加到命令图面。

此类型的 ExtensionPoint> 元素只能有一个子元素:Control 元素。<<>

此扩展点中包含的 Control> 元素必须将 xsi:type 属性设置为 。<MobileButton

Icon> 元素中指定的<图像应采用灰度,使用十六进制代码#919191采用其他颜色格式的等效图像。

示例

<ExtensionPoint xsi:type="MobileOnlineMeetingCommandSurface">
  <Control xsi:type="MobileButton" id="Contoso.onlineMeetingFunctionButton1">
    <Label resid="residUILessButton0Name" />
    <Icon>
      <bt:Image resid="UiLessIcon" size="25" scale="1" />
      <bt:Image resid="UiLessIcon" size="25" scale="2" />
      <bt:Image resid="UiLessIcon" size="25" scale="3" />
      <bt:Image resid="UiLessIcon" size="32" scale="1" />
      <bt:Image resid="UiLessIcon" size="32" scale="2" />
      <bt:Image resid="UiLessIcon" size="32" scale="3" />
      <bt:Image resid="UiLessIcon" size="48" scale="1" />
      <bt:Image resid="UiLessIcon" size="48" scale="2" />
      <bt:Image resid="UiLessIcon" size="48" scale="3" />
    </Icon>
    <Action xsi:type="ExecuteFunction">
      <FunctionName>insertContosoMeeting</FunctionName>
    </Action>
  </Control>
</ExtensionPoint>

MobileLogEventAppointmentAttendee

此扩展点在移动外形规格的约会的命令图面中以上下文方式放置 “日志 ”操作按钮。 安装加载项的约会与会者只需单击一下即可将其约会笔记保存到外部应用。 此扩展点支持任务窗格和函数命令的功能。 若要了解有关此方案的详细信息,请参阅 在 Outlook 移动加载项中将约会笔记记录到外部应用程序

注意

此扩展点仅在具有 Microsoft 365 订阅的 Android 和 iOS 上受支持。

注册 邮箱项目 事件不适用于此扩展点。

子元素

元素 说明
Control 将按钮添加到命令图面。

此类型的 ExtensionPoint> 元素只能有一个子元素:Control 元素。<<>

此扩展点中包含的 Control> 元素必须将 xsi:type 属性设置为 。<MobileButton

Icon> 元素中指定的<图像应采用灰度,使用十六进制代码#919191采用其他颜色格式的等效图像。

示例

<ExtensionPoint xsi:type="MobileLogEventAppointmentAttendee">
  <Control xsi:type="MobileButton" id="appointmentReadFunctionButton">
    <Label resid="LogButtonLabel" />
    <Icon>
      <bt:Image resid="Icon.16x16" size="25" scale="1" />
      <bt:Image resid="Icon.16x16" size="25" scale="2" />
      <bt:Image resid="Icon.16x16" size="25" scale="3" />
      <bt:Image resid="Icon.32x32" size="32" scale="1" />
      <bt:Image resid="Icon.32x32" size="32" scale="2" />
      <bt:Image resid="Icon.32x32" size="32" scale="3" />
      <bt:Image resid="Icon.80x80" size="48" scale="1" />
      <bt:Image resid="Icon.80x80" size="48" scale="2" />
      <bt:Image resid="Icon.80x80" size="48" scale="3" />
    </Icon>
    <Action xsi:type="ExecuteFunction">
      <FunctionName>logToCRM</FunctionName>
    </Action>
  </Control>
</ExtensionPoint>

LaunchEvent

此扩展点使加载项能够基于桌面和移动外形规格中支持的事件激活。 若要详细了解基于事件的激活和受支持的事件的完整列表,请参阅 为基于事件的激活配置 Outlook 外接程序

重要

注册 邮箱项目 事件不适用于此扩展点。

子元素

元素 说明
LaunchEvents 用于基于事件的激活的 LaunchEvent 列表。
SourceLocation 源 JavaScript 文件的位置。

示例

<ExtensionPoint xsi:type="LaunchEvent">
  <LaunchEvents>
    <LaunchEvent Type="OnNewMessageCompose" FunctionName="onMessageComposeHandler"/>
    <LaunchEvent Type="OnNewAppointmentOrganizer" FunctionName="onAppointmentComposeHandler"/>
  </LaunchEvents>
  <!-- Identifies the runtime to be used (also referenced by the Runtime element). -->
  <SourceLocation resid="WebViewRuntime.Url"/>
</ExtensionPoint>

事件

此扩展点添加了指定事件的事件处理程序。 有关使用此扩展点的详细信息,请参阅 Outlook 加载项的 On-send 功能

重要

注册 邮箱项目 事件不适用于此扩展点。

注意

智能警报是发送功能的较新版本,它使用 LaunchEvent 扩展点 在加载项中启用事件激活。 若要详细了解智能警报与发送时功能之间的主要差异,请参阅 智能警报与发送功能之间的差异。 我们邀请你 通过完成演练来试用智能警报

元素 说明
Event 指定事件和事件处理程序函数。

ItemSend 事件示例

<ExtensionPoint xsi:type="Events">
  <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="itemSendHandler" />
</ExtensionPoint>

DetectedEntity

此扩展点在指定实体类型上添加上下文外接程序激活。 有关使用此扩展点的详细信息,请参阅 上下文 Outlook 加载项

重要

基于实体的上下文 Outlook 加载项将在 2024 年第 2 季度停用。 停用此功能的工作将于 5 月开始,并持续到 6 月底。 6 月之后,上下文加载项将无法再检测邮件项目中的实体以对其执行任务。 以下 API 也将停用。

为了帮助最大程度地减少潜在的中断,在基于实体的上下文加载项停用后,仍支持以下内容。

  • 正在开发由联机会议加载项激活的 “加入 会议”按钮的替代实现。 结束对基于实体的上下文加载项的支持后,联机会议加载项将自动转换为替代实现,以激活“ 加入会议 ”按钮。
  • 基于实体的上下文加载项停用后,将继续支持正则表达式规则。 建议更新上下文加载项,以使用正则表达式规则作为替代解决方案。 有关如何实现这些规则的指南,请参阅 使用正则表达式激活规则显示 Outlook 加载项

有关详细信息,请参阅 基于实体的上下文 Outlook 加载项的停用

包含 VersionOverrides 元素的 xsi:type 属性值 VersionOverridesV1_1必须为 。

注意

元素 说明
Label 在上下文窗口中指定外接程序的标签。
SourceLocation 指定上下文窗口的 URL。
Rule 指定确定外接程序激活时间的一个或多个规则。

标签

必需。 组的标签。 resid 属性不能超过 32 个字符,并且必须设置为 Resources 元素中 ShortStrings> 元素中<String> 元素的 id< 属性的值。

突出显示要求

用户可以激活上下文外接程序的唯一方法是与突出显示实体进行交互。 开发人员可以使用 和 ItemHasRegularExpressionMatch规则类型的 Rule> 元素的< Highlight 属性来控制突出显示的实体。ItemHasKnownEntity

但是,存在一些需要注意的限制。 存在这些限制是为了确保在适用的邮件或约会中始终存在一个突出显示实体,以便为用户提供一种激活外接程序的方法。

  • 无法突出显示 EmailAddressUrl 实体类型,因此不能用于激活外接程序。
  • 如果使用单个规则,则必须将 Highlight 属性设置为 all
  • RuleCollection如果使用 规则类型 来Mode="AND"组合多个规则,则至少有一个规则必须将 Highlight 属性设置为 all
  • RuleCollection如果使用 规则类型 来Mode="OR"组合多个规则,则所有规则都必须将 Highlight 属性设置为 all

DetectedEntity 事件示例

<ExtensionPoint xsi:type="DetectedEntity">
  <Label resid="residLabelName"/>
  <!--If you opt to include RequestedHeight, it must be between 140px to 450px, inclusive.-->
  <!--<RequestedHeight>360</RequestedHeight>-->
  <SourceLocation resid="residDetectedEntityURL" />
  <Rule xsi:type="RuleCollection" Mode="And">
    <Rule xsi:type="ItemIs" ItemType="Message" />
    <Rule xsi:type="ItemHasKnownEntity" EntityType="MeetingSuggestion" Highlight="all" />
    <Rule xsi:type="ItemHasKnownEntity" EntityType="Address" Highlight="none" />
  </Rule>
</ExtensionPoint>

ReportPhishingCommandSurface (预览版)

此扩展点在 Outlook 功能区中激活垃圾邮件报告加载项,并防止其显示在功能区末尾或溢出菜单中。

若要详细了解如何在外接程序中实现垃圾邮件报告功能,请参阅 实现集成的垃圾邮件报告加载项 (预览版)

子元素

元素 说明
ReportPhishingCustomization 元素 (预览) 配置垃圾邮件报告加载项的功能区按钮和预处理对话框。

示例

<ExtensionPoint xsi:type="ReportPhishingCommandSurface">
  <ReportPhishingCustomization>
    <!-- Configures the ribbon button. -->
    <Control xsi:type="Button" id="ReportingButton">
      <Label resid="ReportingButton.Label"/>
      <Supertip>
        <Title resid="ReportingButton.Label"/>
        <Description resid="ReportingButton.Description"/>
      </Supertip>
      <Icon>
        <bt:Image size="16" resid="Icon.16x16"/>
        <bt:Image size="32" resid="Icon.32x32"/>
        <bt:Image size="64" resid="Icon.64x64"/>
        <bt:Image size="80" resid="Icon.80x80"/>
      </Icon>
      <Action xsi:type="ExecuteFunction">
        <FunctionName>onMessageReport</FunctionName>
      </Action>
    </Control>
    <!-- Configures the preprocessing dialog. -->
    <PreProcessingDialog>
      <Title resid="PreProcessingDialog.Label"/>
      <Description resid="PreProcessingDialog.Description"/>
      <ReportingOptions>
        <Title resid="OptionsTitle.Label"/>
        <Option resid="Option1.Label"/>
        <Option resid="Option2.Label"/>
        <Option resid="Option3.Label"/>
        <Option resid="Option4.Label"/>
      </ReportingOptions>
      <FreeTextLabel resid="FreeText.Label"/>
      <MoreInfo>
        <MoreInfoText resid="MoreInfo.Label"/>
        <MoreInfoUrl resid="MoreInfo.Url"/>
      </MoreInfo>
    </PreProcessingDialog>
    <SourceLocation resid="Commands.Url"/>
  </ReportPhishingCustomization>
</ExtensionPoint>