【问题标题】:ews-javascript-api getAttachments throw Object doesn't support this actionews-javascript-api getAttachments throw 对象不支持此操作
【发布时间】:2019-02-15 19:36:46
【问题描述】:

我正在使用 ews-js-api-browser 开发 Outlook 桌面插件。
EwsJS 命名空间目前使用<script> 标签导入,如office-js 库。

Office.initialize = function (reason) {
    EwsJS.ConfigureForOutlook()
    EwsJS.EwsLogging.DebugLogEnabled = false
}

const functionWhichNeedAttachment = () => {
Office.context.mailbox.getCallbackTokenAsync((token) => {
    const exch = new EwsJS.ExchangeService(EwsJS.ExchangeVersion.Exchange2016)
    exch.Credentials = new EwsJS.OAuthCredentials(token.value)
    exch.Url = new EwsJS.Uri(Office.context.mailbox.ewsUrl)

    exch.GetAttachments(
      [Office.context.mailbox.item.attachments[0].id],
      1,
      null).then(res => console.log('res', res))

  })
})
}

我收到此错误:

对象不支持此操作 ExchangeWebService.js (41867, 9)

似乎 ExchangeWebService 正在尝试为禁止的关键字分配值。

【问题讨论】:

    标签: ews-javascript-api


    【解决方案1】:

    请看https://docs.microsoft.com/en-us/outlook/add-ins/web-services

    只有一部分 EWS 操作可以使用 mailbox.makeEwsRequestAsync,它由 ews-javascript-api 内部用于 Outlook/Mail 应用程序。

    很遗憾,GetAttachments 在邮件应用程序中不可用。

    【讨论】:

    • 如果是这样,有没有办法从 Outlook 插件中获取附件?
    • 如果您正在查看某些属性,您可以使用本机 Outlook 加载项 API,请参阅 this
    • 我已经看到了,但我想访问附件内容本身。但似乎用 JS add in 是不可能的。感谢您的帮助!
    猜你喜欢
    • 2015-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-18
    • 1970-01-01
    相关资源
    最近更新 更多