Generating Access Token with the Microsoft.Sharepoint.Client version 16.1.22615.12000 in c#

Copper Contributor

Hi, I'm currently creating an azure function that needs to connect with SharePoint I've been following this documentation https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/using-csom-for-dotnet-standard#using-mode...

 

I've created an App Registration in Azure with the following steps:

 

Go to Azure AD Portal via https://aad.portal.azure.com
Select Azure Active Directory and on App registrations in the left navigation
Select New registration
Enter a name for your application and select Register
Go to API permissions to grant permissions to your application, select Add a permission, choose SharePoint, Delegated permissions and select for example AllSites.Manage
Select Grant admin consent to consent the application's requested permissions
Select Authentication in the left navigation
Change Allow public client flows from No to Yes
Select Overview and copy the application ID to the clipboard (you'll need it later on)

 

I'm trying to generate an access token to use in my requests to SharePoint. The sample code provided by Microsoft looks like it's using user credentials. I'm wondering if someone has any sample code that shows how to generate these tokens correctly with just an App Registration? Is it even possible to connect to SharePoint without providing user credentials anymore?

0 Replies