I'm using the latest CSOM library which should be supported .NET Core solution.
However, I can't find SharePointOnlineCredentials class when coding.
What's the required step to use it in .NET Core solution ?
Thanks for any help please :)
I'm using the latest CSOM library which should be supported .NET Core solution.
However, I can't find SharePointOnlineCredentials class when coding.
What's the required step to use it in .NET Core solution ?
Thanks for any help please :)
It has been removed. You shouldn't be using username/pass to access services via API. See https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/using-csom-for-dotnet-standard#using-modern-authentication-with-csom-for-net-standard for more information.
Respectfully I think you've missed the mark.
I agree with trying to keep passwords out of source codes, however, I'd like to call your attention to the current problem I have: I'm a guest on someone else's sharepoint - lets call them BigHealthCompany - they wont let me register a AAD ID and even if they did it'd take weeks for the request to be processed. All I want to do is use my credentials to have a script that automatically takes files out of sharepoint and puts them into a directory and processes them... Yes, in an ideal work you'd use OneDrive and sync the directory then use a FileSystemWatcher; but that also is broken.
So here we are trying to keep from having to use Selenium and ChromeWebDriver from logging in and checking the directory manually.... Oh well -- time is up -- good news for me is I already had Selenium in the project I was working on...
You won't be able to use username/password since you need to go through Modern Auth. You need CID/Secret or something that will otherwise run interactively, especially because you lack control over the tenant.
I ended up making a .net framework 4.8 service that does the same thing OneDrive is supposed to do, using sharepointonlinecredentials. Works great.
So thank you microsoft for making life so much complicated yet again. you did not disappoint. so basically you are asking me to replace one line of code with much more and asking me to go and configure things in azure WOW
Hi developersp1-9584,
It's not possible to use SharePointOnlineCredentials in CSOM for .NET Standard. Instead, it's recommended to use OAuth to acquire an access token.
Here is a blog that demonstrates how to use OAuth 2.0 Resource Owner Password Credentials for fetching the token and use the token in CSOM:
Best Regards,
Baker Kong
Hi developersp1-9584,
Regarding this issue, Is there any other concern? Please feel free to talk with us if you have further questions. And if the above info is helpful to this issue, you can mark it as an answer so that others who stuck in similar issues could get answered quickly
Thanks
Baker Kong
Hi, there's a way to get Sharepoint Authentication Cookie with this new Authentication model? With old SharepointOnlineCredentials , we used GetAuthenticationCookie method to get this, but with new system I don't know how can I get this. Is it posible?
Thanks!
Cookie-based auth is not supported in .net core CSOM as it uses OAuth authentication. Below blog shares the behind requests of SharePointOnlineCredentials, you may have a look. Or you can trace the request using Fiddler
We can convert the steps in above blog to C# code:
Best Regards,
Baker Kong
Hi @MarcMoraGibert-5099 & @developersp1-9584 ,
Regarding this issue, we have not heard from you for some time. Do you have any other questions? If the above info is helpful to this issue, it would be appreciated if you can mark it as an answer so that others who stuck in similar issues could get answered quickly.
Thanks
Baker Kong
4 people are following this question.