office365api - 突破性的改变?在 Office 365/Outlook 日历 View api 中使用 odata.track-changes 时未收到 odata.nextLink?

标签 office365api

我不确定这种情况是什么时候开始发生的(我相信是最近)。如果您依赖此处记录的步骤,那么这是一个重大更改:

https://msdn.microsoft.com/en-us/office/office365/howto/sync-calendar-view

问题是,如果您为“Prefer”指定“odata.track-changes”,则当需要获取更多数据时,Office 365 和 Outlook.com calendarview api 似乎不再返回 @odata.nextLink您的请求中的 header 。

这是一个重现该问题的 CURL 请求...请确保该请求被验证为在指定时间范围内至少有 50 个事件的用户(以触发分页)。

curl -H "Authorization: Bearer <OMITTED>" -H "Accept: application/json; odata.metadata=none" -H "Prefer: odata.track-changes" "https://outlook.office.com/api/v2.0/me/calendarview?startdatetime=2016-06-16T00:00:00Z&enddatetime=2017-06-23T00:00:00Z"

当我发出此请求时,生成的响应有 10 个条目(即使至少有 50 个事件),并且响应没有 @odata.nextLink。然而它确实有一个@odata.deltaLink。

还有其他人遇到此问题吗?

最佳答案

据我所知,它一直都是这样工作的。初始同步返回 deltaLink 而不是 nextLink。您必须特殊对待该初始同步请求,然后使用 deltaToken 继续发出下一个请求。

  1. Initial sync request: The very first sync request sets up the sync state.
  2. Initial sync response:
    • Check for "Preference-Applied: odata.track-changes" in the response header to confirm a successful sync attempt and the resource supports synchronization.
    • If the sync attempt was successful, the initial response always contains an @odata.deltaLink with a deltaToken value. If the response contains any data, save the deltaToken value for the second request.
    • If the initial response wasn't successful, or doesn't return any data indicating there are no events in the specified calendar view, this round of sync ends.
  3. Subsequent sync request: Use the deltaToken or skipToken value from the previous request to issue the next request. See the second and third sync requests as examples.
  4. Subsequent sync response:
    • If the response returns any data, and, there is more data to sync in that time range, the response would include an @odata.nextLink and a skipToken value. Save the skipToken for the next sync request.
    • Go back to step 3, follow the nextLink, if any, apply the corresponding skipToken value in the next sync request, and follow any subsequent nextLink, until you have synchronized all the data in the time range for that calendar.
  5. Final sync response: When all events in the calendar view are synchronized, the final response in this round would include an @odata.deltaLink and a deltaToken again. Save the deltaToken value for the next round of synchronization.

关于office365api - 突破性的改变?在 Office 365/Outlook 日历 View api 中使用 odata.track-changes 时未收到 odata.nextLink?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44599310/

相关文章:

azure - IIS 服务器和 Azure AD

api - Microsoft Graph API - 更新事件不会为与会者更新

javascript - O365 中的 Request_BadRequest

c# - 使用 Node JS - REST API 在 Office365 上召开 session 室 session

azure - 使用 One Drive Business API 访问默认驱动器时出现未经授权的访问错误 (401)

javascript - 在 O365 中创建群组

office365 - 图表似乎没有帮助浏览器缓存配置文件图像

Azure Active Airectory (AAD) 服务到服务身份验证

azure - 如何使用 Graph API 仅从 O365 获取内部消息

azure - 限制 AzureAD 应用程序对某些用户/组的访问