我正试图从2017-06-15T18:24:13Z获取所有消息。
(我正在使用5结果页面,只选择SentDateTime来简化这种情况。选择更多字段和更大页面大小时也会出现此问题)
请求邮件总数:
>>> https://outlook.office.com/api/v2.0/me/messages/$count?$filter=SentDateTime+ge+2017-06-15T18:24:13Z&select=SentDateTime&$top=5
3988
现在提取消息:
>>> https://outlook.office.com/api/v2.0/me/messages/?$filter=SentDateTime+ge+2017-06-15T18:24:13Z&select=SentDateTime&$top=5
{
"@odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Messages(SentDateTime)",
"value": [
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAAAHSJlCAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABMlWeb\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAAAHSJlCAAA=",
"SentDateTime": "2017-06-15T18:27:24Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVnAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSF+rD\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVnAAA=",
"SentDateTime": "2017-06-15T18:37:29Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAAAHSJiQAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAe8\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAAAHSJiQAAA=",
"SentDateTime": "2017-06-15T19:12:22Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVpAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSF+rE\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVpAAA=",
"SentDateTime": "2017-06-15T19:15:58Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl74AAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAe9\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl74AAA=",
"SentDateTime": "2017-06-15T19:20:05Z"
}
],
"@odata.nextLink": "https://outlook.office.com/api/v2.0/me/messages/?%24filter=sentdatetime+ge+2017-06-15T18%3a24%3a13Z&%24select=SentDateTime&%24top=5&%24skip=5"
}
请求下一页:
>>> https://outlook.office.com/api/v2.0/me/messages/?$filter=sentdatetime+ge+2017-06-15T18:24:13Z&$select=SentDateTime&$top=5&$skip=5
{
"@odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Messages(SentDateTime)",
"value": [
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl73AAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAe+\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl73AAA=",
"SentDateTime": "2017-06-15T19:24:13Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl70AAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAe/\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl70AAA=",
"SentDateTime": "2017-06-15T20:19:27Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVtAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSF+rF\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCpAADjWpP0ATh5SI1bqWxqzWOKAABMdlVtAAA=",
"SentDateTime": "2017-06-15T20:20:12Z"
}
]
}
第二个回复不包含nextLink,意味着只有8个结果,最后一条消息是在2017-06-15T20:20:12Z发送的。
但是,在第二天查询时:
>>> https://outlook.office.com/api/v2.0/me/messages/?$filter=SentDateTime+ge+2017-06-16T00:00:00Z&select=SentDateTime&$top=5
{
"@odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Messages(SentDateTime)",
"value": [
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8dAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfR\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8dAAA=",
"SentDateTime": "2017-06-16T00:52:10Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8cAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfS\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8cAAA=",
"SentDateTime": "2017-06-16T01:37:09Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8ZAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfT\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8ZAAA=",
"SentDateTime": "2017-06-16T02:59:38Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8VAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfU\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8VAAA=",
"SentDateTime": "2017-06-16T03:03:25Z"
},
{
"@odata.id": "https://outlook.office.com/api/v2.0/Users('d2fe4aac-1eae-4d14-9893-4f96f42ae46b@487bfe01-8734-4c88-9424-11fa0c5d445e')/Messages('AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8UAAA=')",
"@odata.etag": "W/\"CQAAABYAAADjWpP0ATh5SI1bqWxqzWOKAABSGAfV\"",
"Id": "AAMkADU3ZDE1ZGJiLTg4ZmUtNGVlYy1hYzE4LWMyNjE1NzY4YWUzYQBGAAAAAABGFgzFsCOpRISdXXbGh88oBwA0lgq1qqsaRYyJVwoDR59-AAAvWYCsAADjWpP0ATh5SI1bqWxqzWOKAABMdl8UAAA=",
"SentDateTime": "2017-06-16T03:20:12Z"
}
],
"@odata.nextLink": "https://outlook.office.com/api/v2.0/me/messages/?%24filter=SentDateTime+ge+2017-06-16T00%3a00%3a00Z&%24select=SentDateTime&%24top=5&%24skip=5"
}
意味着确实有比原始请求返回的8更多的消息。
我尝试通过从不同的SentDateTime值开始修改请求,但它会一直停在最后一条消息上。不同日期的不同邮箱也会出现同样的问题。
有关如何处理此事的任何线索?
修改 作为临时修复,我循环遍历所有文件夹(使用/ me / mailFolders)并使用相同的过滤器一次获取它们。这似乎取代了正确的解决方案
答案 0 :(得分:0)
您可以尝试从sentItems文件夹中查询数据吗?
https://outlook.office.com/api/v2.0/me/mailFolders/SentItems/messages/ $滤波器= SentDateTime + GE + 2017-06-15T18:24:13Z&安培;选择= SentDateTime&安培; $顶= 5