我正在开发 Outlook Web 插件,目前停留在 manifest.xml
。我可以上传 list 而不会出现错误,但 ExecuteFunction
元素以某种方式被忽略。
当我删除<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
时及其子元素 ExecuteFunction
正在工作,但这不是选项,因为我需要它来获取 OAuth token 。
这是link我们设法得到 WebApplicationInfo
工作。
所以我的问题是:是否有可能有 WebApplicationInfo
和ExecuteFunction
在同一个 list 中?
list 如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<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.1"
xsi:type="MailApp">
<!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->
<!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
<Id>c64ded7d-29e6-4083-8afa-351c7a630668</Id>
<!--Version. Updates from the store only get triggered if there is a version change. -->
<Version>1.0.0.0</Version>
<ProviderName>An Tran</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
<DisplayName DefaultValue="MyMeetings" />
<Description DefaultValue="Find a room"/>
<!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/hi-res-icon.png"/>
<SupportUrl DefaultValue="https://contoso.com/support " />
<!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
<AppDomains>
<AppDomain>AppDomain1</AppDomain>
<AppDomain>AppDomain2</AppDomain>
<AppDomain>AppDomain3</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/index.html"/>
<RequestedHeight>250</RequestedHeight>
</DesktopSettings>
</Form>
<Form xsi:type="ItemEdit">
<DesktopSettings>
<SourceLocation DefaultValue="https://localhost:3000/index.html"/>
</DesktopSettings>
</Form>
</FormSettings>
<Permissions>ReadWriteItem</Permissions>
<Rule xsi:type="RuleCollection" Mode="Or">
<Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Edit" />
<Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Read" />
</Rule>
<DisableEntityHighlighting>false</DisableEntityHighlighting>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<!-- <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1"> -->
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
<FunctionFile resid="functionFile" />
<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
<OfficeTab id="TabDefault">
<Group id="apptComposeDemoGroup">
<Label resid="groupLabel" />
<!-- Function (UI-less) button -->
<Control xsi:type="Button" id="apptComposeFunctionButton">
<Label resid="funcComposeButtonLabel" />
<Supertip>
<Title resid="funcComposeSuperTipTitle" />
<Description resid="funcComposeSuperTipDescription" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="80" resid="icon80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>run</FunctionName>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
<!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="icon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="icon80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="functionFile" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
<bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="groupLabel" DefaultValue="MyMeetings Group"/>
<bt:String id="customTabLabel" DefaultValue="My Add-in Tab"/>
<bt:String id="funcComposeSuperTipTitle" DefaultValue="Find a room!"/>
<bt:String id="funcComposeButtonLabel" DefaultValue="MyMeetings!"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="funcComposeSuperTipDescription" DefaultValue="Find a most suitable room with MyMeetings."/>
</bt:LongStrings>
</Resources>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<WebApplicationInfo>
<Id>c64ded7d-29e6-4083-8afa-351c7a630668</Id>
<Resource>api://localhost:3000/c64ded7d-29e6-4083-8afa-351c7a630668</Resource>
<Scopes>
<Scope>files.read.all</Scope>
<Scope>profile</Scope>
</Scopes>
</WebApplicationInfo>
</VersionOverrides>
</VersionOverrides>
</OfficeApp>
最佳答案
您的函数未触发,因为您使用的 Outlook 版本支持 VersionOverridesV1_1
,但您的 VersionOverridesV1_1
未声明 functionFile
(或除 WebApplicationInfo
之外的任何内容)。
来自documentation :
The child
VersionOverrides
element doesn't inherit any values from the parent.
换句话说,在 VersionOverridesV1_0
中声明的内容不会被 VersionOverridesV1_1
继承。您需要在两个部分中包含相同的元素(即主机
、资源
等):
...
<VersionOverrides
xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
<FunctionFile resid="functionFile" />
<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
<OfficeTab id="TabDefault">
<Group id="apptComposeDemoGroup">
<Label resid="groupLabel" />
<!-- Function (UI-less) button -->
<Control xsi:type="Button" id="apptComposeFunctionButton">
<Label resid="funcComposeButtonLabel" />
<Supertip>
<Title resid="funcComposeSuperTipTitle" />
<Description resid="funcComposeSuperTipDescription" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="80" resid="icon80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>run</FunctionName>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="icon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="icon80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="functionFile" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="groupLabel" DefaultValue="MyMeetings Group"/>
<bt:String id="funcComposeSuperTipTitle" DefaultValue="Find a room!"/>
<bt:String id="funcComposeButtonLabel" DefaultValue="MyMeetings!"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="funcComposeSuperTipDescription" DefaultValue="Find a most suitable room with MyMeetings."/>
</bt:LongStrings>
</Resources>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<!-- Repeat the same declarations as VersionOverridesV1_0 -->
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
<FunctionFile resid="functionFile" />
<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
<OfficeTab id="TabDefault">
<Group id="apptComposeDemoGroup">
<Label resid="groupLabel" />
<!-- Function (UI-less) button -->
<Control xsi:type="Button" id="apptComposeFunctionButton">
<Label resid="funcComposeButtonLabel" />
<Supertip>
<Title resid="funcComposeSuperTipTitle" />
<Description resid="funcComposeSuperTipDescription" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="80" resid="icon80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>run</FunctionName>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="icon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="icon80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="functionFile" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="groupLabel" DefaultValue="MyMeetings Group"/>
<bt:String id="funcComposeSuperTipTitle" DefaultValue="Find a room!"/>
<bt:String id="funcComposeButtonLabel" DefaultValue="MyMeetings!"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="funcComposeSuperTipDescription" DefaultValue="Find a most suitable room with MyMeetings."/>
</bt:LongStrings>
</Resources>
<WebApplicationInfo>
<Id>c64ded7d-29e6-4083-8afa-351c7a630668</Id>
<Resource>api://localhost:3000/c64ded7d-29e6-4083-8afa-351c7a630668</Resource>
<Scopes>
<Scope>files.read.all</Scope>
<Scope>profile</Scope>
</Scopes>
</WebApplicationInfo>
</VersionOverrides>
</VersionOverrides>
...
关于office-js - VersionOverridesV1_1 不触发 ExecuteFunction 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48417389/