Microsoft Graph API按时间间隔获取日历更改,并按lastModifiedDateTime进行过滤

时间:2020-10-28 12:27:19

标签: graph microsoft-graph-api microsoft-graph-calendar

我正在尝试在特定日期之后在日历中获取修改或创建的事件。

  1. documentation link之后,我可以使用此网址获取今年的活动。

https://graph.microsoft.com/v1.0/me/calendarview?startDateTime=2020-01-01T00:00:00&endDateTime=2021-01-01T00:00:00

  1. 由于我只想在特定日期后尝试使用filter和lastModifiedDateTime属性来获取修改或创建的事件,所以通过这种方式

https://graph.microsoft.com/v1.0/me/calendarview?startDateTime=2020-01-01T00:00:00&endDateTime=2021-01-01T00:00:00&$filter=lastModifiedDateTime%20gt%202020-10-01T00:00:00z

试图获取本月修改的事件,我得到一个空响应,甚至没有错误。

  1. 我也documentation link使用了这种方式

https://graph.microsoft.com/v1.0/me/calendarView/delta?startDateTime=2020-01-01T00:00:00&endDateTime=2021-01-01T00:00:00&lastModifiedDateTime%20gt%202020-10-01T00:00:00z

,但它会返回一年中的所有事件,并且不会按lastModifiedDateTime进行过滤。

是否有任何适当的方法来获取在特定日期之后修改或创建的日历事件?

1 个答案:

答案 0 :(得分:0)

貌似calendarView无法与过滤器一起正常工作,可行的替代方法是过滤器列表事件Documentation Link

有效的网址如下:https://graph.microsoft.com/v1.0/me/calendar/events?$filter=lastModifiedDateTime%20gt%20" + date + "z"