【问题标题】:Am I using Office.context.mailbox.item.addHandlerAsync correctly?我是否正确使用 Office.context.mailbox.item.addHandlerAsync?
【发布时间】:2018-09-18 17:49:54
【问题描述】:

我正在将 Office.context.mailbox.item.addHandlerAsync 用于约会项目上的 o365 加载项。我希望每次我调整约会时间或添加/删除参与者时处理程序都会触发。我在打开加载项时看到回调触发,但在与约会交互时没有。

initOfficeListener = () => {
  const { addHandlerAsync, start } = Office.context.mailbox.item;
  const { AppointmentTimeChanged, RecipientsChanged } = Office.EventType;

  addHandlerAsync(
    AppointmentTimeChanged,
    eventArgs => {
      start.getAsync(this.processStart);
    },
    result => console.log(result)
  );
}

【问题讨论】:

  • 您能否分享您面临此问题的客户端版本号?您的处理程序是否在 Office.Initialize 方法调用中初始化?
  • 是的 Office.initialize = this.officeInitializer; 进行一些设置然后调用 initOfficeListener。而且我不确定客户端内部版本号是多少,这些是我在清单中使用的版本:<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="MailApp" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0">
  • 当您说“我希望处理程序每​​次都触发...”时,您的意思是每次都调用 addhandlerAsync 吗? Office.Initialize 仅在应用首次加载时调用一次。当您更改约会时间/收件人时,每次都应该调用您的回调函数,您没有看到这种情况发生吗?使用 AddHandlerAsync 注册事件后,无需在每次更改时重新注册。
  • 没错,我没有看到回调触发。
  • 每次启动时都会抛出此错误:OSF.DDA.AsyncResult {value: undefined, status: "failed", error: OSF.DDA.Error}

标签: javascript outlook outlook-web-addins


【解决方案1】:

需要升级到 1.5 或更高版本。

【讨论】:

  • 一开始为什么会出现这个问题?
猜你喜欢
  • 2016-01-24
  • 2014-05-15
  • 2010-12-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-15
相关资源
最近更新 更多