【发布时间】:2021-11-05 20:19:22
【问题描述】:
我不是所有 Azure 方面的专家,但我想以编程方式阅读我自己的日历。我找到了一些代码来访问 Microsoft Graph 并阅读我的日历,但似乎我必须先创建一个应用注册,如果我只需要阅读我的 OWN 日历,是否可以跳过应用注册?这是我的出发点:
var scopes = new[] { "User.Read" };
var options = new TokenCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
};
var userName = "myaccount@company.com";
var password = "pwdhere";
var userNamePasswordCredential = new UsernamePasswordCredential(
userName, password, tenantId, clientId, options);
var graphClient = new GraphServiceClient(userNamePasswordCredential, scopes);
var events = await graphClient.Me.Calendar.Events
.Request()
.Filter("startsWith(subject,'All')")
.GetAsync();
【问题讨论】:
标签: c# azure microsoft-graph-api