选择以过滤响应结果

时间:2018-07-06 20:18:58

标签: rest api office365 outlook-restapi

我正在使用Outlook REST API创建Outlook事件并将文件附加到现有的EventID。

我正在尝试过滤附件文件的响应结果以捕获附件ID和大小,但是$ select过滤器不起作用。

这是我附加文件的方式。 (假定已经创建了EventID。)$ select = Id,Name,Size没有过滤:

POST: https://outlook.office.com/api/v2.0/me/events/{eventId}/attachments?$select=Id,Name,Size
authorization: bearer {token}
content-type: application/json
{
"@odata.type":"#Microsoft.OutlookServices.FileAttachment",
"Name":"test.txt",
"ContentBytes":"aHR0cDovL2dpb25rdW56LmdpdGh1Yi5pby9jaGFydGlzdC1qcy9leGFtcGxlcy5odG1sDQoNCmh0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9MGttZGpxZ085SVkNCjM2OjAyDQpodHRwczovL3d3dy55b3V0dWJlLmNvbS93YXRjaD92PW9FVHY2djlmN3djIA0KNjoxOQ0KDQpodHRwczovL2FuZ3VsYXItdWkuZ2l0aHViLmlvL2Jvb3RzdHJhcC8="
}

仅过滤ID,名称和大小,响应结果并没有得到过滤:

{
  "@odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Events('AAMkADA1OWVjOTkxLTlmYmEtNDAwMS0.....=')/Attachments(Name)/$entity",
  "@odata.type": "#Microsoft.OutlookServices.FileAttachment",
  "@odata.id": "https://outlook.office.com/api/v2.0/Users('c843f11-9069............')/Events('AAMkADA1OWVjOTkxLTlmYmEtNDAwMS0.....=')/Attachments('AAMkADA1OWVjOTkxLTlmYmEtNDAwMS...=')",
  "Id": "AAMkADA1OWVjOTkxLTlmYmEtNDAwMS...==",
  "LastModifiedDateTime": "2018-07-06T19:54:53Z",
  "Name": "t5.pdf",
  "ContentType": "application/pdf",
  "Size": 356,
  "IsInline": false,
  "ContentId": null,
  "ContentLocation": null,
  "ContentBytes": "aHR0cDovL2dpb25rdW56LmdpdGh1Yi5pby9jaGFydGlzdC1qcy9leGFtcGxlcy5odG1sDQoNCmh0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9MGttZGpxZ085SVkNCjM2OjAyDQpodHRwczovL3d3dy55b3V0dWJlLmNvbS93YXRjaD92PW9FVHY2djlmN3djIA0KNjoxOQ0KDQpodHRwczovL2FuZ3VsYXItdWkuZ2l0aHViLmlvL2Jvb3RzdHJhcC8="
}

$ select过滤器在做什么?

其背后的原因:有时附件很大。因此,ContentBytes也很大。可能需要很长时间或无法捕获附件ID,因此我想排除ContentBytes

0 个答案:

没有答案