ClientSecretCredential, The method or operation is not implemented error

-- -- 892 Reputation points


I am trying to get a MS Graph to read some documents from SharePoint. This needs to be done without a user being logged in. I am using code below at the end to do so. I have created app and client secret in Azure AD. However when I run below code I get a 'System.NotImplementedException: The method or operation is not implemented' error on line;

var clientSecretCredential = new ClientSecretCredential(tenantId, clientId, clientSecret, options);

What am I missing?



   var scopes = new[] { "" };

   var tenantId = "...";

   var clientId = "...";
   var clientSecret = "...";

   var options = new TokenCredentialOptions
       AuthorityHost = AzureAuthorityHosts.AzurePublicCloud

   var clientSecretCredential = new ClientSecretCredential(tenantId, clientId, clientSecret, options);

   graphClient = new GraphServiceClient(clientSecretCredential, scopes);
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,087 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,135 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 38,941 Reputation points

    Hi @-- --

    Try this:

    string[] scopes = { "" };  
    IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder  
    ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication, scopes);  
    GraphServiceClient graphClient = new GraphServiceClient(authProvider);  

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful