How to use Graph Explorer SDK?

做~自己de王妃 提交于 2021-01-29 12:35:31

问题


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: The collection type 'Microsoft.Graph.IUserAppRoleAssignmentsCollectionPage' on 'Microsoft.Graph.User.AppRoleAssignments' is not supported.

来源:https://stackoverflow.com/questions/62776361/how-to-use-graph-explorer-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!