通过OutlookServicesClient获取日历事件 [英] Get calendar events by OutlookServicesClient

查看:224
本文介绍了通过OutlookServicesClient获取日历事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此线程中报告了相同的问题 Office365 REST v1.0 API日历不返回重复发生

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

答案说使用 https://outlook.office365.com/api/v1.0/Me/CalendarView 而不是 https://outlook.office365.com/api/v1.0/Me/Events 获取所有事件(包括系列事件)

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)

我的问题是我正在使用OutlookServicesClient调用de O365 API.这就是我所说的".../事件":

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();

我试图用这种方式称呼".../calendarview":

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();

我得到一个异常,指出需要startdatetime和enddatetime".看起来该库未在发送参数,并且我的where子句正在转换为$ filter OData查询

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

是否可以使用OutlookServicesClient库调用CalendarView?

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

谢谢

推荐答案

如果未在下面找到问题的答案,则为示例代码:

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();

即使Microsoft表示不支持此功能,也可以使用客户端库获取CalendarView.

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

这篇关于通过OutlookServicesClient获取日历事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆