【问题标题】:Get calendar events by OutlookServicesClient通过 OutlookServicesClient 获取日历事件
【发布时间】:2015-02-19 18:11:01
【问题描述】:

我在这个帖子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 来获取所有事件(包括系列事件)

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

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”:

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 查询

有没有办法使用 OutlookServicesClient 库调用 CalendarView?

谢谢

【问题讨论】:

  • 找到答案了吗?
  • 没有。我没有找到解决办法。我正在使用outlookServicesClient.Me.Calendar.Events。 :(

标签: exchangewebservices office365


【解决方案1】:

如果您没有找到问题的答案,下面是示例代码:

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

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

【讨论】:

  • 刚刚发现了相同的选项。这是正确的答案(想添加这个我自己:p)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-12-19
  • 2014-03-13
  • 2013-01-18
  • 1970-01-01
  • 2011-08-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多