How to use Graph Explorer 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: The collection type ‘Microsoft.Graph.IUserAppRoleAssignmentsCollectionPage’ on ‘Microsoft.Graph.User.AppRoleAssignments’ is not supported.