Microsoft Graph SDK .NET get events in range

陌路散爱 提交于 2019-12-08 03:30:58

问题


I tried to get all the events in a certain range using the following code

DateTime dateStart = DateTime.Parse("2018-07-20T11:00:00"), dateEnd = dateStart.AddDays(1);

List<QueryOption> options = new List<QueryOption>()
{
    new QueryOption("startDateTime", dateStart.ToUniversalTime().ToString()),
    new QueryOption("endDateTime", dateEnd.ToUniversalTime().ToString())
};

var eventsInRange = await graphClient.Me.Calendar.Events.Request(options).GetAsync();

But it returns the events in all history, not only in range. Is there a way to solve this?


回答1:


You're calling the /events endpoint using /calendarView parameters. You want to use the CalendarView class:

var eventsInRange = await graphClient.Me
    .Calendar
    .CalendarView
    .Request(options)
    .GetAsync();


来源:https://stackoverflow.com/questions/51526017/microsoft-graph-sdk-net-get-events-in-range

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