简体   繁体   中英

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. I am able to make this query using the regular HttpClient but for convenience reasons would like to do this through the 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:

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. If I remove the end/dateTime portion I get values just for the start/dateTime day. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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