c# - 如何使用图形资源管理器 SDK?
问题描述
public class GraphService
{
public async Task<dynamic> CreateGraphClient()
{
string clientId = "";
string tenantID = "";
string redirectUri = "http://localhost";
//string clientSecret = "";
string email = "myemail";
SecureString password = new NetworkCredential("", "mypass").SecurePassword;
string[] scopes = { "https://graph.microsoft.com/User.Read" };
IPublicClientApplication publicClientApplication = PublicClientApplicationBuilder
.Create(clientId )
.WithTenantId(tenantID)
.Build();
UsernamePasswordProvider authProvider = new UsernamePasswordProvider(publicClientApplication, scopes);
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
User me = await graphClient.Me.Request()
.WithUsernamePassword(email, password)
.GetAsync();
return me;
}
}
NotSupportedException:不支持“Microsoft.Graph.User.AppRoleAssignments”上的集合类型“Microsoft.Graph.IUserAppRoleAssignmentsCollectionPage”。
解决方案
推荐阅读
- javascript - React 表单中onSubmit调用的函数没有运行
- reactjs - 如何在反应中下载可从服务器下载的excel文件
- javascript - 在 javascript/jquery 中为 html 类分配带空格的变量
- apache - 无法设置 ProxyWebsocketIdleTimeout
- git - 使 Git 内部(.git 目录)不区分大小写兼容
- powerbi - 在 Power BI 中设置移动默认开始和结束日期
- unity3d - 有没有办法设置滑块值在使用时的变化量?
- r - 错误:`mutate()` 列 `nested.col` 有问题。ℹ `nested.col = purrr::map(...)`
- c# - 如何从抽象类中构造当前的具体类型?
- react-native - 如何从 React Native 访问健康数据