无法检索 'ContentId'Office365 REST Api 中的附件属性 [英] Unable to retrieve 'ContentId' property of Attachment in Office365 REST Api
问题描述
我正在尝试检索 Office365 rest api 中的附件.由于我想避免下载整个附件,因此我使用了一个 select 子句来避免下载 ContentBytes 属性中的内容:
$select="ContentId,ContentType,Id,IsInline,Name,Size"
所以基本上,我想检索除内容之外的所有内容.但是,这给出了以下错误消息(json):
<代码> {错误":{"code": "RequestBroker-ParseUri","message": "在类型 'Microsoft.OutlookServices.Attachment' 上找不到名为 'ContentId' 的属性."}}
它告诉我 ContentId 不存在,这与 规格.
这是完整的请求:
<预> <代码> GET/api/v2.0/me/messages/AAMkAGZlZjI3N2I3LTg1YWUtNDFiNC05MGI0LTVjYTVmZGI5NGI2YQBGAAAAAABzr8uDji9LRqgTCEsDv22wBwBWTXbvZW0dTKuxUGxpK4-lAAAAAAEMAABWTXbvZW0dTKuxUGxpK4-lAAC5QnKBAAA=/attachments?%24select=ContentId%2CContentType%2CId%2CIsInline%2CName%2CSize更奇怪的是,当我在没有指定任何 select 子句的情况下执行相同的查询时,它会返回一个完整的附件对象,包括一个 ContentId.
有人可以帮忙吗?
如果有人对 microsoft graph 有同样的问题,你需要通过这个过滤器:
$select=microsoft.graph.fileAttachment/contentId
像这样:
GET https://graph.microsoft.com/v1.0/me/messages/attachments?$select=microsoft.graph.fileAttachment/contentId
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"
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'."
}
}
It's telling me that ContentId doesn't exist, which contradicts the specifications.
Edit: Here is the full request:
GET /api/v2.0/me/messages/AAMkAGZlZjI3N2I3LTg1YWUtNDFiNC05MGI0LTVjYTVmZGI5NGI2YQBGAAAAAABzr8uDji9LRqgTCEsDv22wBwBWTXbvZW0dTKuxUGxpK4-lAAAAAAEMAABWTXbvZW0dTKuxUGxpK4-lAAC5QnKBAAA=/attachments?%24select=ContentId%2CContentType%2CId%2CIsInline%2CName%2CSize
Even more strange, when I do the same query without specifying any select clause, it returns me a full attachment object, including a ContentId.
Anybody can help?
In case anyone has the same question for microsoft graph, you need to pass this filter:
$select=microsoft.graph.fileAttachment/contentId
like this:
GET https://graph.microsoft.com/v1.0/me/messages/attachments?$select=microsoft.graph.fileAttachment/contentId
这篇关于无法检索 &#39;ContentId&#39;Office365 REST Api 中的附件属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!