1

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.

Jason Johnston
  • 17,194
  • 2
  • 20
  • 34
seaders
  • 3,878
  • 3
  • 40
  • 64
  • 1
    After spending a good few hours on this over the weekend, I don't think this is possible. I ended up just getting all events, and filtering them locally after converting the date-times to times and working from there. Unfortunately I can't see any other way around. Would love a regex option though, would be simple enough with that. – seaders Jul 27 '15 at 13:48

1 Answers1

-2

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

Jason Johnston
  • 17,194
  • 2
  • 20
  • 34
  • Same as what I've posted, that works on *date-time* instead of just time. If you can somehow point to how, using calendarview, to get all events after the end of a workday, 5.30PM and before the start of a workday, 9AM using this, I'll mark your answer correct. – seaders Jul 27 '15 at 16:44
  • I think I misunderstood. So you want to find events on all days, just as long as the time portion is either less than 9AM or greater than 5:30PM? If so, that isn't possible given the current state of the API. You would have to do it day by day. I can pass along your requirement to the engineering team though. – Jason Johnston Jul 27 '15 at 18:19
  • Yep, that's what I was trying to do and learned that it wasn't possible with the API atm. But, as I said, if regex was available, it'd be a simple enough one, `r'(0[0-8]:\d{2}|17:[3-5]\d|(1[8-9]|2[0-3]):\d{2})'` and shouldn't be that much worse, performance-wise, than the equals. – seaders Jul 28 '15 at 00:44
  • @JasonJohnston Is this still true- calendar view only seems to return 10 events unless I add in $top, which seems to be limited to 50. – apchester Aug 19 '16 at 16:20
  • Yes, all queries for a collection of items in the Outlook APIs default to a limit of 10 unless you use `$top`. – Jason Johnston Aug 19 '16 at 16:45