问题
The Microsoft Office team annouced today the availability of a REST API across the Office365 suite, as well as guides for writing apps across the different app ecosystems.
To evaluate the API, I simply wanted to get a listing of my events for today.
The new API seems to be relatively unchanged from the preview API
The basic GET is quite simple:
https://outlook.office365.com/api/v1.0/me/events
This gives back listing of calendar events. To get a specific day, we should be able to use OData Query Parameters.
For example:
https://outlook.office365.com/api/v1.0/me/events?$filter=End gt 2014-10-28 and Start lt 2014-10-29
This gives a much shorter list, but it's not quite right.
There are no recurring events that weren't created in that timeframe.
This seems to be a known issue with the preview (EWS/OData) API:
- Office 365 API recurring meetings not always returning
- Office 365 API EWS calendar not expanding recurring events
There are some work-arounds mentioned in the above isssues, but there are notes that the API is in flux and that those approaches may not work in the v1.0 release. Furthermore those work-arounds don't seem to still apply, which is why this question is not a duplicate.
So, how can one get all of today's events, including recurrences, via the Office365 REST v1.0 API?
回答1:
Thanks for your interest in Office 365 REST APIs. You are correct that, in V1.0, GET on events returns single instance meetings and series masters, and doesn't expand series. We have two ways to expand recurrences. We just checked and it looks like that documentation is missing and we will update it ASAP. In the meantime, here is the info that should unblock you:
CalendarView: You can use this API to get list of all events (single instances and occurrences of series) for a given timeframe. Timeframe is specified in UTC, so you have to ask for the right times based on your user's time zone. Time zone support is high on our priority list and will be coming soon. Here is an example request to fetch list of events for October 1-31 PDT:
https://outlook.office365.com/api/v1.0/Me/CalendarView/?startDateTime=2014-10-01T07:00:00Z&endDateTime=2014-11-01T07:00:00Z
Please note: We are in the process of fixing a bug where navigating the "next" link in the response doesn't work, but a fix is already on its way.
Instances of a Specific Meeting Series: You can use this API to expand a specific meeting series for a specified time period. Once again, times are in UTC. Here is an example to expand a specific meeting series to get list of instances for October 1-31 PDT:
https://outlook.office365.com/api/v1.0/Me/Events('AAMkA...')/instances?startDateTime=2014-10-01T07:00:00Z&endDateTime=2014-11-01T07:00:00Z
Please let me know if you have any questions or need more info.
Thanks,
Venkat
来源:https://stackoverflow.com/questions/26610853/office365-rest-v1-0-api-calendar-does-not-return-recurrences