我正在尝试构建一个Outlook Web加载项,该加载项根据电子邮件收件人更改电子邮件正文的内容。我目前有一个compose view命令,该命令可触发并成功报告该处理程序已注册,但是我从未看到该处理程序被调用。
Office.context.mailbox.item.addHandlerAsync(
Office.EventType.RecipientsChanged,
event => {
console.log("event handled", event);
},
args => {
console.log("handler registered status", args.status);
}
);
调用此代码时,我会看到handler registered status succeeded
的日志,但是在更改收件人时,我永远不会看到event handled
的日志。我目前正在尝试使用网络版Outlook进行此操作,并且在我检查时报告支持API 1.7。
我的清单是
<?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>a7aa0a09-480d-435e-bae7-35e2c35d89de</Id>
<Version>1.0.0.0</Version>
<ProviderName>POC</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="On Recipient Change Handler"/>
<Description DefaultValue="A proof of concept"/>
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-80.png"/>
<SupportUrl DefaultValue="https://localhost:3000/support.html" />
<AppDomains>
<AppDomain>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"/>
<!-- Message Compose -->
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgComposeCmdGroup">
<Label resid="GroupLabel"/>
<Control xsi:type="Button" id="msgComposeAddHandler">
<Label resid="FunctionButton.Label"/>
<Supertip>
<Title resid="FunctionButton.Title"/>
<Description resid="FunctionButton.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>addHandler</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:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="GroupLabel" DefaultValue="Handler"/>
<bt:String id="FunctionButton.Label" DefaultValue="Set Handler"/>
<bt:String id="FunctionButton.Title" DefaultValue="Set Handler"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="FunctionButton.Tooltip" DefaultValue="Set up a handler"/>
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
答案 0 :(得分:1)
当前仅Action xsi:type =“ ShowTaskpane”支持事件,Action xsi:type =“ ExecuteFunction”不支持事件