如何从Office 365的REST API ItemAttachment内容是什么? [英] How to retrieve ItemAttachment contents from Office 365 REST API?

查看:471
本文介绍了如何从Office 365的REST API ItemAttachment内容是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:非常感谢Venkat在下面回答这个

UPDATE: Many thanks to Venkat for answering this below!

的get请求需要如为了检索的.msg附件的内容如下被格式化:

The get request needs to be formatted as follows in order to retrieve the contents of a .msg attachment:

<$c$c>https://outlook.office365.com/api/v1.0/me/messages/{messageid}/attachments/{AttachmentId}?$expand=Microsoft.OutlookServices.ItemAttachment/Item

(原题)

我最初问微软的Office开发中心这个问题。一个主持人的要求,我在这里提出这个问题。

I originally asked this question in Microsoft's Office Dev Center. One of the moderators requested that I pose this question here.

我一直在使用Office 365邮件REST API有很多成功的。然而,试图获取附加到其他电子邮件(即项目附件像.msg文件)的电子邮件时,REST API不提供。

I've been having a lot of success using the Office 365 Mail REST API. However, when trying to retrieve email messages that are attached to other emails (i.e., Item Attachments like .msg files), the REST API does not deliver.

当我做出这样的GET请求为附加了一个.msg文件的电子邮件,我得到的所有的附件属性的除了的项目属性,它应该包含附件(据这里的Office 365的邮件REST API资源指南:<一href=\"https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#RESTAPIResourcesItemAttachment\" rel=\"nofollow\">https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#RESTAPIResourcesItemAttachment)

When I make a GET request like this for an email that has a .msg file attached to it, I get all the attachment properties except the "Item" property, which should contain the attachment (according to the Office 365 Mail REST API resource guide here: https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#RESTAPIResourcesItemAttachment)

GET: https://outlook.office365.com/api/v1 0.0 / ME /邮件/ {}消息ID /附件

GET: https://outlook.office365.com/api/v1.0/me/messages/{messageid}/attachments

响应:

{
  "@odata.context": "https://outlook.office365.com/api/v1.0/$metadata#Me/{messageid}/Attachments",
  "value": [
    {
      "@odata.type": "#Microsoft.OutlookServices.ItemAttachment",
      "@odata.id": "https://outlook.office365.com/api/v1.0/Users('{useremailaddress}')/{messageid}/Attachments('{messageid}')",
      "Id": "{messageid}",
      "Name": "{subject}",
      "ContentType": "message/rfc822",
      "Size": 54425,
      "IsInline": false,
      "DateTimeLastModified": "{timestamp}"
    }
  ]
}

我是不是做错了什么?

Am I doing something wrong?

推荐答案

是的,我们的文档需要就如何检索项目更清晰。请尝试<$c$c>https://outlook.office365.com/api/v1.0/me/messages/{messageid}/attachments/{AttachmentId}?$expand=Microsoft.OutlookServices.ItemAttachment/Item让我知道这对你的作品。

Yes, our documentation needs to be much clearer on how to retrieve the Item. Please try https://outlook.office365.com/api/v1.0/me/messages/{messageid}/attachments/{AttachmentId}?$expand=Microsoft.OutlookServices.ItemAttachment/Item and let me know if this works for you.

这篇关于如何从Office 365的REST API ItemAttachment内容是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆