【发布时间】:2020-05-27 22:58:00
【问题描述】:
IPublicClientApplication publicClientApplication = PublicClientApplicationBuilder
.Create("dcb4a15***d745b428b2ac")
.WithTenantId("8392***f0b-93b0-d4013318ea7d")
.Build();
var password = new SecureString();
password.AppendChar('*');
password.AppendChar('*');
password.AppendChar('*');
UsernamePasswordProvider authProvider = new UsernamePasswordProvider(publicClientApplication, scopes);
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
User me = await graphClient.Me.Request()
.WithUsernamePassword("username.onmicrosoft.com", password)
.GetAsync();
var queryOptions = new List<QueryOption>()
{
new QueryOption("startDateTime", "2020-02-18T16:00:00.0000000"),
new QueryOption("endDateTime", "2020-02-18T16:00:00.0000000")
};
var calendarView = await graphClient.Me.Calendar.CalendarView
.Request(queryOptions)
.GetAsync();
上面的代码是为了在 c#.net 中获取日历视图而编写的,但它不起作用。我没有使用图表从日历中获取任何数据,我使用的是 bot 框架 4,我添加了 microsoft.graph、microsoft.graph.auth 包、microsoft.identity.client
【问题讨论】:
-
你最好不要在帖子中包含任何个人信息,我已经编辑了你的帖子。
标签: c# .net botframework microsoft-graph-calendar