Aug 30 2022 10:14 AM
I am using the following code to query the Graph API to retrieve a Team's call information. However, I constantly get the error (pasted below). I am not sure what I am missing. Any help is much appreciated.
Code:
// The client credentials flow requires that you request the
// /.default scope, and preconfigure your permissions on the
// app registration in Azure. An administrator must grant consent
// to those permissions beforehand.
string[] scopes = new[] { "https://graph.microsoft.com/.default" };
// Multi-tenant apps can use "common",
// single-tenant apps must use the tenant ID from the Azure portal
//string tenantId = "common";
string tenantId = AzureDetails.TenantID;
// Values from app registration
string clientId = AzureDetails.ClientID;
string clientSecret = AzureDetails.ClientSecret;
// using Azure.Identity;
TokenCredentialOptions options = new()
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
};
// https://docs.microsoft.com/dotnet/api/azure.identity.clientsecretcredential
ClientSecretCredential clientSecretCredential = new(tenantId, clientId, clientSecret, options);
GraphServiceClient graphClient = new(clientSecretCredential, scopes);
call = await graphClient.Communications.Calls[id].Request().GetAsync();
Exception:
Code: UnknownError
Inner error:
AdditionalData:
date: 2022-08-30T17:11:46
request-id: b00e1f14-82d7-459b-bbdc-ae13ae04cdb2
client-request-id: b00e1f14-82d7-459b-bbdc-ae13ae04cdb2
ClientRequestId: b00e1f14-82d7-459b-bbdc-ae13ae04cdb2
Thanks,
Puneeth