Work with SharePoint using C# code

Copper Contributor
Hi All,
 
Need help regarding SharePoint Authentication.
 
There is WS-Trust Authentication used to connect with SharePoint using C#. As Microsoft has removed WS-Trust, does this affect SharePoint connection as well OR it is for Microsoft Dataverse? Please note that we are using username and password to work with SharePoint API.
 
Use of Office365 authentication with Microsoft Dataverse
 
 
Is there any way to connect with SharePoint API using Client Id and Client Secret? So, we can simply replace Username and Password with that?
 
What would be the ideal way to work with SharePoint using C# code? SharePoint API OR SharePoint Library? That would be great if you share some reference links.
 
Any help will be appreciated.
 
Thank you
1 Reply

I also googled a lot but I couldn't find any solution without using a username and password. You can use this solution https://github.com/pnp/pnpcore/tree/dev/samples/Demo.ASPNetCore It uses Azure Ad authentication. https://www.youtube.com/watch?v=2ZOnWp9mqY0&ab_channel=PiaSysTechBites also this one. But any solution doesn't give you what you want. I think it is necessary because you have to own some username for any SharePoint operations. Another solution is using powershell for some operations. If you have already some scripts you can easily run ps1 scripts on .net core.