I am trying to develop a CSOM console app for a SharePoint 2019 site and I'm having trouble authenticating.
I've tried:
context.Credentials = new NetworkCredential("username", "password", "domain"); and
ICredentials credentials = CredentialCache.DefaultCredentials; context.Credentials = credentials; (CredentialCache.DefaultCredentials had empty strings for Domain, Password, and UserName)
I've also tried
var credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials(username, securePassword); after having created the secure password.
Any other suggestions?
NetworkCredentialandCredentialCache.DefaultCredentialssuccessfully in many programs in the past. Are you on the same network as the SharePoint server(s)? Not being on the same network is the only thing I can think of that may cause problems.