c# - Microsoft Graph 用于在 C# 中读取我自己的日历?
问题描述
我不是所有 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();
解决方案
您需要注册应用程序,否则您甚至无法登录。如果它是您无法控制的 Azure AD,例如您的雇主,您需要让管理员为您创建它。
推荐阅读
- scala - 以编程方式从 Google 电子表格中删除空单元格以避免 5000000 单元格限制错误
- web - 在 IE11 的 Web Worker 中使用 URL.createObjectURL
- python - 计算数据框中列表中每个单词的单词频率
- pandas - 在熊猫中使用 groupBy 后每月对数据进行排序
- python-2.7 - ld 在arch linux上构建时找不到与python模块相关的函数
- java - ListView 以编程方式添加列
- spring-data-jpa - JPA 存储库本机查询忽略 ::timestamptz
- haskell - `[ (x !! 0, x !! 1) | x <- mapM (const ['A', 'B', 'C'] ) [1..2], head x < head (tail x) ]` 有效吗?
- python - 使用 Python ElementTree 和 minidom 漂亮地打印 XML 时禁用转义
- excel - 从链接地址复制工作簿并将其粘贴到范围地址