简体   繁体   English

Microsoft Graph SDK .NET获取范围内的事件

[英]Microsoft Graph SDK .NET get events in range

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? 有办法解决吗?

You're calling the /events endpoint using /calendarView parameters. 您正在使用/calendarView参数调用/events端点。 You want to use the CalendarView class: 您要使用CalendarView类:

var eventsInRange = await graphClient.Me
    .Calendar
    .CalendarView
    .Request(options)
    .GetAsync();

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

相关问题 Microsoft Graph SDK .NET获取范围内的组事件 - Microsoft Graph SDK .NET get group events in range Microsoft Graph .NET SDK - 检索ListItem字段 - Microsoft Graph .NET SDK - Retrieving ListItem Field 使用 C# 和 Microsoft Graph SDK 从日历中获取事件 - Getting Events from Calendar using C# and Microsoft Graph SDK 使用 Microsoft Graph API SDK .net Core 获取 MIME 和/或 EML 电子邮件内容/格式 - Get MIME and/or EML Email Content/ format using Microsoft Graph API SDK .net Core 如何使用.Net Client SDK从Microsoft Graph获取我所属的管理员角色? - How to get admin roles that I am a member of, from Microsoft Graph using .Net Client SDK? Microsoft graph 无需用户即可访问以获取日历事件 - Microsoft graph get access without a user to get calendar events 使用Microsoft Graph .NET SDK更新用户个人资料照片 - Update user profile photo with Microsoft Graph .NET SDK 关于在Microsoft Graph .Net SDK中重用GraphServiceClient的建议是什么? - What is the recommendation to reuse GraphServiceClient in Microsoft Graph .Net SDK? .NET的Microsoft Graph SDK是否自动处理速率限制? - Does the Microsoft Graph SDK for .NET automatically handle rate limits? 如何在 powershell 中使用 Microsoft Graph .NET SDK? - How can i use Microsoft Graph .NET SDK in powershell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM