MS Graph SDK:向CalendarView添加参数

Gre*_*aue 0 .net c# microsoft-graph

我在Graph Rest API中有以下语句,它返回给定DateTime中某个日历的所有事件:

https://graph.microsoft.com/beta/me/calendars/ID/calendarView?startDateTime=2017-02-01T10:31:37Z&endDateTime=2017-02-10T10:31:37Z

我如何使用SDK执行此操作?到目前为止我得到了什么:

ICalendarEventsCollectionPage retrievedEvent = await graphClient.Me.Calendars[id].CalendarView...

小智 6

您可以将这些作为QueryOptions添加到请求中.


    QueryOption startDateTime = new QueryOption("startDateTime", "2017-02-01T10:31:37Z");
    QueryOption endDateTime = new QueryOption("endDateTime", "2017-02-10T10:31:37Z");
    List options = new List();
    options.Add(startDateTime);
    options.Add(endDateTime);

    ICalendarCalendarViewCollectionPage retrievedEvents = await graphClient
                                                                .Me
                                                                .Calendars["id"]
                                                                .CalendarView
                                                                .Request(options)
                                                                .GetAsync();

Run Code Online (Sandbox Code Playgroud)