Jul 06 2023 05:24 AM - edited Jul 06 2023 05:27 AM
Hi!
i'm new in using the GraphAPI. We are developing an ASP.NET MVC application (.NET Framework 4.7) and wanted to use the GraphAPI (5.17). We are using a client secret to authenticate as application (without user interaction).
Now my problem:
With fiddler we can see the authentication works fine! We're getting a bearer token but the request to the GraphAPI is missing. I can't find other expamples. Im not getting any response. The task idles in status "WaitingForActivation"
Here my code:
var scopes = new[] { "https://graph.microsoft.com/.default" };
// using Azure.Identity;
var options = new ClientSecretCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
};
var clientSecretCredential = new ClientSecretCredential(
tenantId, clientId, clientSecret, options);
var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
MailboxSettings set = graphClient.Users["email address removed for privacy reasons"].MailboxSettings.GetAsync().Result;
log.info(set.Language.Locale);
I tried the same request with an classic HttpRequestMessage with no problems!
Thx 4 Help
Greetings from Cologne!