seaders
seaders

Reputation: 4106

Office365 REST API query calendar entries for only events outside of work hours

I'm trying to get a log of all entries in my Outlook calendar that occurred before 9AM and after 5PM. Is there a way I can query that via REST, or do I have to retrieve all entries locally and evaluate the data their data there?

I've checked

https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#RESTAPIResourcesEvent

and

https://msdn.microsoft.com/office/office365/APi/calendar-rest-operations#GetEventCollection

But while there is $search and $filter options, for the Start field is a full DateTime, not just time, so, on first glance, trying to figure these things out doesn't seem capable.

$filter does have and, or, lt and gt, among other operators, but it doesn't seem to have like a SQL, or mongo like operation that I could maybe query for a list of start times for any date, or better yet, a regex string operation.

It's looking like I'll have to just get all entries, and work from there, but I definitely thought I'd ask before doing that.

Upvotes: 1

Views: 1720

Answers (1)

Jason Johnston
Jason Johnston

Reputation: 17702

Have you looked at the calendarview endpoint? It gives all appointments within a window:

GET https://outlook.office365.com/api/{version}/me/calendarview?startDateTime={start_datetime}&endDateTime={end_datetime}

https://msdn.microsoft.com/office/office365/APi/calendar-rest-operations#Getevents

Upvotes: -2

Related Questions