无法在Office365 REST Api中检索附件的'ContentId'属性 [英] Unable to retrieve 'ContentId' property of Attachment in Office365 REST Api

查看:144
本文介绍了无法在Office365 REST Api中检索附件的'ContentId'属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Office365 rest api中检索附件.由于我想避免下载整个附件,因此我使用了select子句来避免下载内容,该内容位于ContentBytes属性中:

I'm trying to retrieve attachments in the Office365 rest api. Since I want to avoid downloading the entire attachments, I'm using a select clause to avoid downloading the content, which is in the ContentBytes property:

    $select="ContentId,ContentType,Id,IsInline,Name,Size"

因此,基本上,我想检索除内容以外的所有内容.但是,这给出了以下错误消息(json):

So basically, I want to retrieve everything except the content. However, this gives the following error message (json):

    { 
       "error": 
          {
           "code": "RequestBroker-ParseUri",
           "message": "Could not find a property named 'ContentId' on type 'Microsoft.OutlookServices.Attachment'."
          }
    }

这是在告诉我ContentId不存在,这与规格.

It's telling me that ContentId doesn't exist, which contradicts the specifications.

这是完整的请求:

    GET /api/v2.0/me/messages/AAMkAGZlZjI3N2I3LTg1YWUtNDFiNC05MGI0LTVjYTVmZGI5NGI2YQBGAAAAAABzr8uDji9LRqgTCEsDv22wBwBWTXbvZW0dTKuxUGxpK4-lAAAAAAEMAABWTXbvZW0dTKuxUGxpK4-lAAC5QnKBAAA=/attachments?%24select=ContentId%2CContentType%2CId%2CIsInline%2CName%2CSize 

更奇怪的是,当我在不指定任何选择子句的情况下执行相同的查询时,它返回一个完整的附件对象,包括ContentId.

Even more strange, when I do the same query without specifying any select clause, it returns me a full attachment object, including a ContentId.

有人可以帮忙吗?

推荐答案

如果有人对Microsoft图形有相同的问题,则需要通过以下过滤器:

In case anyone has the same question for microsoft graph, you need to pass this filter:

$select=microsoft.graph.fileAttachment/contentId

像这样:

GET https://graph.microsoft.com/v1.0/me/messages/attachments?$select=microsoft.graph.fileAttachment/contentId

这篇关于无法在Office365 REST Api中检索附件的'ContentId'属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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