outlook addin уведомление - PullRequest
       22

outlook addin уведомление

0 голосов
/ 15 апреля 2019

Я хотел бы разработать простую надстройку для Outlook, которая отображает подтверждающее сообщение перед отправкой электронной почты. По какой-то причине в нем отображается только сообщение об ошибке по умолчанию: «Надстройка xxx блокирует отправку этого письма». Кроме того, даже если я разрешаю завершить мероприятие, оно не позволяет мне отправлять.

manifest.xml

  <Permissions>ReadWriteMailbox</Permissions>

  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Edit" />
  </Rule>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <!-- On Send requires VersionOverridesV1_1 -->
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
      <Description resid="residAppDescription" />
      <Requirements>
        <bt:Sets DefaultMinVersion="1.3">
          <bt:Set Name="Mailbox" />
        </bt:Sets>
      </Requirements>
      <Hosts>
        <Host xsi:type="MailHost">
          <DesktopFormFactor>
            <!-- The functionfile and function name to call on message send.  -->
            <!-- In this particular case the function calculateCostAndWarn will be called within the JavaScript code referenced in residUILessFunctionFileUrl. -->
            <FunctionFile resid="residUILessFunctionFileUrl" />
            <ExtensionPoint xsi:type="Events">
              <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="calculateCostAndWarn" />
            </ExtensionPoint>
          </DesktopFormFactor>
        </Host>
      </Hosts>
      <Resources>
        <bt:Urls>
          <!-- The JavaScript code is hosted on a secure and trusted web server. -->
          <bt:Url id="residUILessFunctionFileUrl" DefaultValue="https://localhost:3000/index.html" ></bt:Url>
        </bt:Urls>
      </Resources>
    </VersionOverrides>
  </VersionOverrides>

index.js

var mailboxItem;

Office.initialize = function (reason) {
    mailboxItem = Office.context.mailbox.item;
}

// Entry point for add-in before send is allowed.
function calculateCostAndWarn(event) {
	mailboxItem.notificationMessages.addAsync("information", {
	    type: "informationalMessage",
	    message : "The add-in processed this message.",
	    icon : "iconid",
	    persistent: false
	});
	event.completed({ allowEvent: true });
}

enter image description here

1 Ответ

0 голосов
/ 16 апреля 2019

глупая ошибка, ссылка на index.js в index.html неверна

...