outlook addin通知消息

问题描述 投票:0回答:1

我想开发一个简单的outlook插件,在发送电子邮件之前显示确认消息。出于某种原因,它只显示默认错误消息“addin 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

node.js api events outlook-addin office-js
1个回答
0
投票

愚蠢的错误,index.html中对index.js的引用是错误的

© www.soinside.com 2019 - 2024. All rights reserved.