问题
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