3

We are planning to turn off legacy authentication on a tenant and this requires a change in an application made in C#. The app is currently using CSOM and connects to SharePoint using a username and password. This needs to be changed to PnP Framework, and connection with clientid and secret.

I am familiar with PowerShell, but not much with C#. I imported the PnP Framework in a test C#, but having problems how to begin to use the library. I would like to replicate the Connect-PnPOnline -Url $url -ClientId $clientid -ClientSecret $clientsecret command as a start (then probably the rest will go as well). I found a CSOM workaround with username and pw, but that doesn't work in our case. Can somebody please help me with a start?

vilmarci
  • 451
  • 10
  • 31

1 Answers1

0

You can usually create an authenticated ClientContext like this

var clientContext = new PnP.Framework.AuthenticationManager().GetACSAppOnlyContext(siteurl, clientid, clientsecret);
stefffdev
  • 176
  • 1
  • 9