Как правильно зарегистрировать обработчик для Office.EventType.RecipientChanged в Outlook? - PullRequest
0 голосов
/ 21 июня 2019

Я пытаюсь создать надстройку Outlook Web, которая изменяет содержимое тела письма в зависимости от получателей электронной почты.В настоящее время у меня есть команда составления представления, которая запускает и успешно сообщает, что обработчик зарегистрирован, но я никогда не вижу вызываемого обработчика.

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>

1 Ответ

1 голос
/ 30 июня 2019

В настоящее время события поддерживаются только для Action xsi: type = "ShowTaskpane", но не для Action xsi: type = "ExecuteFunction"

...