如何在Outlook的AppointmentOrganizerCommandSurface上添加自定义操作按钮
问题原因&解决方案
你当前的配置存在3个核心错误,导致按钮无法显示在预期位置:
- 激活规则不匹配:当前配置的规则仅覆盖了邮件阅读场景,没有包含约会编辑场景,导致约会界面的扩展点完全不会触发
- 扩展点类型错误:你使用的
AppointmentOrganizerCommandSurface是用于在Ribbon功能区新增选项卡/组,而Giphy按钮所在的约会顶部快捷操作栏需要使用AppointmentOrganizerCommandBar扩展点 - 版本不兼容:
AppointmentOrganizerCommandBar扩展点需要VersionOverridesV1_1版本支持,你当前仅配置了1.0版本的覆盖规则
修改步骤
- 更新激活规则
将原有Rule节点替换为以下内容,覆盖约会编辑场景:
<Rule xsi:type="RuleCollection" Mode="Or"> <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read"/> <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Edit" ItemClass="IPM.Appointment"/> </Rule>
- 新增V1.1版本的覆盖规则
在原有VersionOverrides(1.0版本)的结束标签</VersionOverrides>之后,新增以下配置:
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1"> <Requirements> <bt:Sets DefaultMinVersion="1.5"> <bt:Set Name="Mailbox"/> </bt:Sets> </Requirements> <Hosts> <Host xsi:type="MailHost"> <DesktopFormFactor> <FunctionFile resid="Commands.Url"/> <!-- 快捷操作栏扩展点 --> <ExtensionPoint xsi:type="AppointmentOrganizerCommandBar"> <OfficeTab id="TabDefault"> <Group id="apptOrganizerQuickGroup"> <Label resid="GroupLabel"/> <!-- 自定义按钮配置 --> <Control xsi:type="Button" id="apptQuickActionButton"> <Label resid="ActionButton.Label"/> <Supertip> <Title resid="ActionButton.Label"/> <Description resid="ActionButton.Tooltip"/> </Supertip> <Icon> <bt:Image size="16" resid="Icon.16x16"/> <bt:Image size="32" resid="Icon.32x32"/> <bt:Image size="80" resid="Icon.80x80"/> </Icon> <Action xsi:type="ExecuteFunction"> <FunctionName>action</FunctionName> </Action> </Control> </Group> </OfficeTab> </ExtensionPoint> </DesktopFormFactor> </Host> </Hosts> <!-- 复用现有资源配置即可 --> <Resources> <bt:Images> <bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon-16.png"/> <bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon-32.png"/> <bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png"/> </bt:Images> <bt:Urls> <bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/commands.html"/> </bt:Urls> <bt:ShortStrings> <bt:String id="GroupLabel" DefaultValue="Contoso Add-in"/> <bt:String id="ActionButton.Label" DefaultValue="执行操作"/> </bt:ShortStrings> <bt:LongStrings> <bt:String id="ActionButton.Tooltip" DefaultValue="点击按钮执行自定义操作"/> </bt:LongStrings> </Resources> </VersionOverrides>
- 生效配置
修改完成后重新侧加载插件,重启Outlook客户端即可看到按钮显示在Giphy所在的快捷操作栏。如果是网页版Outlook需要清除浏览器缓存后再测试。
注意事项
- 本地开发时要确保所有图标资源可以正常访问,无跨域或404问题
- 若不需要保留原有的Ribbon功能区按钮,可以删除1.0版本中
AppointmentOrganizerCommandSurface扩展点的相关配置
内容的提问来源于stack exchange,提问作者SimoMatavulj
相关产品推荐
相关产品推荐

