Get calendar events by OutlookServicesClient

老子叫甜甜 提交于 2019-12-11 10:13:49

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/28613782/get-calendar-events-by-outlookservicesclient

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!