无法在 Office365 REST Api 中检索附件的“ContentId”属性

gwy*_*ers 3 rest office365-restapi

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

    $select="ContentId,ContentType,Id,IsInline,Name,Size"
Run Code Online (Sandbox Code Playgroud)

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

    { 
       "error": 
          {
           "code": "RequestBroker-ParseUri",
           "message": "Could not find a property named 'ContentId' on type 'Microsoft.OutlookServices.Attachment'."
          }
    }
Run Code Online (Sandbox Code Playgroud)

它告诉我 ContentId 不存在,这与规范相矛盾。

编辑:这是完整的请求:

    GET /api/v2.0/me/messages/AAMkAGZlZjI3N2I3LTg1YWUtNDFiNC05MGI0LTVjYTVmZGI5NGI2YQBGAAAAAABzr8uDji9LRqgTCEsDv22wBwBWTXbvZW0dTKuxUGxpK4-lAAAAAAEMAABWTXbvZW0dTKuxUGxpK4-lAAC5QnKBAAA=/attachments?%24select=ContentId%2CContentType%2CId%2CIsInline%2CName%2CSize 
Run Code Online (Sandbox Code Playgroud)

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

有人可以帮忙吗?

met*_*gfu 8

如果有人对 microsoft graph 有同样的问题,你需要通过这个过滤器:

$select=microsoft.graph.fileAttachment/contentId
Run Code Online (Sandbox Code Playgroud)

像这样:

GET https://graph.microsoft.com/v1.0/me/messages/attachments?$select=microsoft.graph.fileAttachment/contentId
Run Code Online (Sandbox Code Playgroud)