Fabio
Fabio

Reputation: 11990

Get calendar events by OutlookServicesClient

I have the same issue reported in this thread Office365 REST v1.0 API calendar does not return recurrences

The answer says to use https://outlook.office365.com/api/v1.0/Me/CalendarView instead of https://outlook.office365.com/api/v1.0/Me/Events to get all events (including ocurrences of series)

My problem is that I'm using the OutlookServicesClient to call de O365 API. This is how I call the ".../events":

var eventsResults = await (from i in outlookServicesClient.Me.Events
                           where i.Start >= start && i.Start <= end
                           orderby  i.Start
                           select i).Take(10).ExecuteAsync();

I tried to call the ".../calendarview", in this way:

var eventsResults = await (from i in outlookServicesClient.Me.CalendarView
                           where i.Start >= start && i.End <= end
                           orderby  i.Start
                           select i).Take(10).ExecuteAsync();

I get an exception that says "startdatetime and enddatetime is required". Looks like the library is not sending the parameters, and my where clause is being transformed to $filter OData query

Is there any way to call CalendarView using the OutlookServicesClient library?

Thank you

Upvotes: 1

Views: 626

Answers (1)

Mistique
Mistique

Reputation: 61

In case you didn't found answer for your question below is a sample code:

var eventsResults = await outlookServicesClient.Me.Calendar.GetCalendarView(new DateTimeOffset(startDate).UtcDateTime, new DateTimeOffset(endDate).UtcDateTime).Take(int.MaxValue).ExecuteAsync();

Even if Microsoft is saying that this is not supported you can get CalendarView using Client Libraries.

Upvotes: 3

Related Questions