问题
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