如何为Outlook Add-in创建单Tab,点击即打开Taskpane?
Outlook Add-in 自定义Tab配置方案
要实现仅保留“Contoso Add-in”主Tab,点击即可打开Taskpane,需对清单文件做以下核心修改:
修改步骤
替换默认Tab为自定义Tab
找到<ExtensionPoint xsi:type="MessageReadCommandSurface">下的<OfficeTab id="TabDefault">节点,替换为自定义Tab配置,同时移除多余的操作按钮。添加自定义Tab的标签资源
在<bt:ShortStrings>区域新增自定义Tab的名称配置。清理冗余内容
删除不需要的ActionButton控件及无关的函数执行配置(可选保留)。
修改后的完整清单代码
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0" xsi:type="MailApp"> <Id>37cba818-c575-4ac2-85fe-332d9eae8213</Id> <Version>1.0.0.0</Version> <ProviderName>Contoso</ProviderName> <DefaultLocale>en-US</DefaultLocale> <DisplayName DefaultValue="outlook-addin"/> <Description DefaultValue="A template to get started."/> <IconUrl DefaultValue="https://localhost:3000/assets/icon-64.png"/> <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-128.png"/> <SupportUrl DefaultValue="https://www.contoso.com/help"/> <AppDomains> <AppDomain>https://www.contoso.com</AppDomain> </AppDomains> <Hosts> <Host Name="Mailbox"/> </Hosts> <Requirements> <Sets> <Set Name="Mailbox" MinVersion="1.1"/> </Sets> </Requirements> <FormSettings> <Form xsi:type="ItemRead"> <DesktopSettings> <SourceLocation DefaultValue="https://localhost:3000/taskpane.html"/> <RequestedHeight>250</RequestedHeight> </DesktopSettings> </Form> </FormSettings> <Permissions>ReadWriteItem</Permissions> <Rule xsi:type="RuleCollection" Mode="Or"> <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read"/> </Rule> <DisableEntityHighlighting>false</DisableEntityHighlighting> <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0"> <Requirements> <bt:Sets DefaultMinVersion="1.3"> <bt:Set Name="Mailbox"/> </bt:Sets> </Requirements> <Hosts> <Host xsi:type="MailHost"> <DesktopFormFactor> <!-- 若无需执行函数可删除此行 --> <FunctionFile resid="Commands.Url"/> <ExtensionPoint xsi:type="MessageReadCommandSurface"> <!-- 自定义Tab配置 --> <CustomTab id="ContosoAddinTab"> <Label resid="TabLabel"/> <Group id="msgReadGroup"> <Label resid="GroupLabel"/> <Control xsi:type="Button" id="msgReadOpenPaneButton"> <Label resid="TaskpaneButton.Label"/> <Supertip> <Title resid="TaskpaneButton.Label"/> <Description resid="TaskpaneButton.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="ShowTaskpane"> <SourceLocation resid="Taskpane.Url"/> </Action> </Control> </Group> </CustomTab> </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:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html"/> </bt:Urls> <bt:ShortStrings> <bt:String id="GroupLabel" DefaultValue="Contoso Add-in"/> <bt:String id="TaskpaneButton.Label" DefaultValue="Show Taskpane"/> <!-- 新增自定义Tab标签 --> <bt:String id="TabLabel" DefaultValue="Contoso Add-in"/> </bt:ShortStrings> <bt:LongStrings> <bt:String id="TaskpaneButton.Tooltip" DefaultValue="Opens a pane displaying all available properties."/> </bt:LongStrings> </Resources> </VersionOverrides> </OfficeApp>
效果说明
修改后,Outlook界面将只显示“Contoso Add-in”自定义Tab,点击Tab内的按钮即可直接打开Taskpane,完全符合需求。
内容的提问来源于stack exchange,提问作者Shiv Yadav
相关产品推荐
相关产品推荐

