onenote-apimicrosoft-graph-onenote

How to get authProvider for OneNote API


I'm using MS.Graph and trying to get a list of my OneNote Notebooks.

Here is the code I'm using.

IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
.Create(clientId)
.WithTenantId(tenantID)
.WithClientSecret(clientSecret)
.Build();

ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication);

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var notebooks = await graphClient.Me.Onenote.Notebooks
    .Request()
    .GetAsync();

I can get the clientID, but where/how to I get the tenantID and clientSecret?


Solution

  • I used Microsoft.Graph.Auth (Pre-Release) from NuGet. That fixed the problem