【问题标题】:Cannot get attachments in Outlook Calendar add-in无法在 Outlook 日历加载项中获取附件
【发布时间】:2017-11-02 16:35:13
【问题描述】:

我正在开发仅在日历中显示的 Microsoft Outlook Web 插件。但是,我无法使用 api:Office.context.mailbox.item.attachments 获取约会附件,并且 attachments 对象未定义。 我想指出,在邮件阅读中,我可以毫无问题地获取附件详细信息。这仅在日历中发生。 你有什么建议吗?

【问题讨论】:

  • 您能提供详细信息吗?你在哪个平台上重现这个,你有那个客户端的内部版本号吗?
  • @OutlookAdd-insTeam-MSFT,用于测试我在 Chrome 中使用 Windows 桌面版本 16.0.8528.2126 和 outlook.com
  • 您的加载项的权限是什么?您使用的是哪个需求集?澄清一下,当您说日历时,您的意思只是日历读取模式?
  • 我的权限是:<Permissions>ReadItem</Permissions> <Rule xsi:type="RuleCollection" Mode="Or"> <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Read" /> </Rule> 我尝试在预约阅读时使用加载项。但是,每次我在 Outlook 中打开约会时,它都会在编辑模式下打开(但我猜它已经结束了)。

标签: outlook office365 outlook-addin office-js office-addins


【解决方案1】:

正如上面提到的 mufeez,Office.context.mailbox.item.attachmentsis not supported in edit mode

【讨论】:

  • 那么,如果我是会议的组织者,我可以通过某种方式访问​​附件吗?
【解决方案2】:

/* 您能否尝试使用下面的代码片段,它在 mycase 中适用于最新的 Outlook for Windows 16.0.8625.2121,我对我的加载项拥有 ReadWriteMailbox 权限,虽然这不是强制性的,但它应该与 @987654322 一起使用@还有

/* Office.context.mailbox.item.attachments 在编辑模式下不支持,即当您是约会/会议的组织者时 */

/* ReadItem 或 ReadWriteItem 或 ReadWriteMailbox / / 获取附件列表 */

var outputString = "";
for (i = 0; i < Office.context.mailbox.item.attachments.length; i++) {
     var _att = Office.context.mailbox.item.attachmen[i];
     outputString += "<BR>" + i + ". Name: ";
     outputString += _att.name;
     outputString += "<BR>ID: " + _att.id;
     outputString += "<BR>contentType: "+_att.contentType;
     outputString += "<BR>size: " + _att.size;
     outputString += "<BR>attachmentType: " + _att.attachmentType;
     outputString += "<BR>isInline: " + _att.isInline;
}

【讨论】:

  • 不,它不起作用。正如我在问题中所写,attachments 对象身份不明,因此我无法遍历它。
  • 您似乎是本次会议/约会的组织者,在编辑模式下打开日历,目前在编辑模式下不支持Office.context.mailbox.item.attachments
  • 那么作为组织者没有办法获取附件吗?
  • 最好的办法是保存正在编辑的项目,然后使用 REST API 查询附件。
猜你喜欢
  • 1970-01-01
  • 2020-10-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多