I am using Outlook REST API to fetch events from Outlook calendar.
The client I am using is .NET one.
My goal is to fetch events from a specific calendar (I have calendarid of the calendar with me) for next 6 months starting from now.
In order to do that I followed this section: Get events from the user's calendar (Client)
I tried achieving fetching events for a calendar for a time range via two different methods:
First, via events collection:
await client.Me.Events[calendarID]
and
Second, via calendars collection
await client.Me.Calendars[calendarID].Events
but I am not even able to compile that code since it is giving the error:
Cannot apply indexing to an expression of type 'Microsoft.Office365.OutlookServices.ICalendarCollection.
The very first line of that paragraph in their documentation states this:
To get the events from a different calendar, call the calendar's Events property.
Did I do something wrong in my code?
Does anyone know where is the sample of fetching events from a specific calendar for a time range?
Does anyone know where is the list of samples for accessing their various other APIs via .NET client.
I even went here O365-Win-Snippets/src/Calendar/CalendarSnippets.cs and couldn't find what I need. There is no sample for fetching events for a specific calendar.
I have already gone through:
https://stackoverflow.com/a/34725030/148657
but that addresses only timerange and not specific calendar.