简体   繁体   English

如何使用Microsoft Graph C#SDK查看结束日期和开始日期之间的calendarView

[英]How to Use Microsoft Graph C# SDK to see calendarView Between an End and Start date

I'm trying to use the Microsoft Graph SDK to query the calendarView endpoint. 我正在尝试使用Microsoft Graph SDK来查询calendarView终结点。 I am able to make this query using the regular HttpClient but for convenience reasons would like to do this through the SDK. 我可以使用常规HttpClient进行此查询,但出于方便起见,我想通过SDK进行此查询。 The endpoint that I would be trying to hit with the query params looks like this: 我将尝试使用查询参数访问的端点如下所示:

GET /v1.0/me/calendar/calendarView?startDateTime=2019-01-01T00:00:00.0000000&endDateTime=2019-03-01T00:00:00.0000000

I've attempted to make the call through the Graph SDK this way: 我试图通过Graph SDK通过以下方式进行调用:

var graphClient = new GraphServiceClient(new PreAuthorizedBearerTokenAuthenticationProvider(accessToken));
var rooms = await graphClient.Me.Events.Request().Filter("start/dateTime eq '2019-01-08T20:00:00.0000000' and end/dateTime eq '2019-01-08T20:00:00.0000000'").GetAsync();

I am receiving a 200 for this but my response has no values in it. 我为此收到200,但我的回应中没有任何值。 If I remove the end/dateTime portion I get values just for the start/dateTime day. 如果删除end / dateTime部分,则仅获得start / dateTime日的值。 It seems like the filter works only for specifics and not for a range. 过滤器似乎仅适用于特定条件,不适用于范围。 Does anyone have any hints for filtering within a range? 有人在范围内进行过滤有任何提示吗?

var queryOptions = new List<QueryOption>()
{
    new QueryOption("startDateTime", "2019-01-01T00:00:00.0000000"),
    new QueryOption("endDateTime", "2019-03-01T00:00:00.0000000")
};

UserCalendarViewCollectionPage todaysEvents = await graphClient.Me.CalendarView.Request(queryOptions).GetAsync();

CalendarView docs CalendarView文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM