使用 Id 和 Outlook REST API 检索邮件项目
Retrieving mail items with Id and Outlook REST API
给定一个 ID 列表(也称为 ItemId),我们如何使用 OutlookREST 有效地检索电子邮件 Api?
我试图伪造以下请求。
https://outlook.office365.com/api/beta/me/MailFolders/<somefolderId>/messages?$filter=((Id eq 'firstId') or (Id eq 'secondId') or (Id eq 'thirdId'))
但是我收到了 BadRequest 400 error: "The property 'Id' does not support filtering" 这很清楚。
作为解决方法,我使用 InternetMessageId(我不关心返回电子邮件的哪个 "copy")。有没有办法使用 Id 来获得更好的性能?
对于 batch request 中的每个 ID,您最多可以执行 20 个单独的 GET
请求。目前仅在 beta
端点可用。
类似于:
POST https://outlook.office.com/api/beta/$batch HTTP/1.1
Authorization: Bearer aGFwcHlnQGRr==
Host: outlook.office.com
Content-Type: multipart/mixed; boundary=batch_myBatchId
--batch_myBatchId
Content-Type: application/http
Content-Transfer-Encoding: binary
GET /api/beta/me/messages/{id1} HTTP/1.1
--batch_myBatchId
Content-Type: application/http
Content-Transfer-Encoding: binary
GET /api/beta/me/messages/{id2} HTTP/1.1
--batch_myBatchId--
给定一个 ID 列表(也称为 ItemId),我们如何使用 OutlookREST 有效地检索电子邮件 Api?
我试图伪造以下请求。
https://outlook.office365.com/api/beta/me/MailFolders/<somefolderId>/messages?$filter=((Id eq 'firstId') or (Id eq 'secondId') or (Id eq 'thirdId'))
但是我收到了 BadRequest 400 error: "The property 'Id' does not support filtering" 这很清楚。
作为解决方法,我使用 InternetMessageId(我不关心返回电子邮件的哪个 "copy")。有没有办法使用 Id 来获得更好的性能?
对于 batch request 中的每个 ID,您最多可以执行 20 个单独的 GET
请求。目前仅在 beta
端点可用。
类似于:
POST https://outlook.office.com/api/beta/$batch HTTP/1.1
Authorization: Bearer aGFwcHlnQGRr==
Host: outlook.office.com
Content-Type: multipart/mixed; boundary=batch_myBatchId
--batch_myBatchId
Content-Type: application/http
Content-Transfer-Encoding: binary
GET /api/beta/me/messages/{id1} HTTP/1.1
--batch_myBatchId
Content-Type: application/http
Content-Transfer-Encoding: binary
GET /api/beta/me/messages/{id2} HTTP/1.1
--batch_myBatchId--