C# MS Graph SDK:向CalendarView添加参数

C# MS Graph SDK:向CalendarView添加参数,c#,.net,microsoft-graph-api,C#,.net,Microsoft Graph Api,我在Graph Rest API中有以下语句,它返回给定日期时间内特定日历中的所有事件: https://graph.microsoft.com/beta/me/calendars/ID/calendarView?startDateTime=2017-02-01T10:31:37Z&endDateTime=2017-02-10T10:31:37Z 如何使用SDK实现这一点?到目前为止,我得到的是: ICalendarEventsCollectionPage retrievedEvent=Wait

我在Graph Rest API中有以下语句,它返回给定日期时间内特定日历中的所有事件:

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

如何使用SDK实现这一点?到目前为止,我得到的是:


ICalendarEventsCollectionPage retrievedEvent=Wait graphClient.Me.Calendars[id].CalendarView…

您可以将这些作为查询选项添加到请求中


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


您可以将这些作为查询选项添加到请求中


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


这很好。谢谢但是,如果您还想将事件限制为一个或两个扩展属性值,该怎么办?您想添加一个筛选语句吗?您可以添加如下过滤器选项:。请求(选项).Filter(“名称eq'Contoso')).GetAsync();我最终使用了
事件
而不是
日历视图
。根据文档,
日历视图
不能与
过滤器
机制一起使用。但我的问题现在解决了。谢谢,这很好。谢谢但是,如果您还想将事件限制为一个或两个扩展属性值,该怎么办?您想添加一个筛选语句吗?您可以添加如下过滤器选项:。请求(选项).Filter(“名称eq'Contoso')).GetAsync();我最终使用了
事件
而不是
日历视图
。根据文档,
日历视图
不能与
过滤器
机制一起使用。但我的问题现在解决了。谢谢