I just found out where I got it wrong: I created the project using .NET Core instead of .NET Framework. Once I created a new solution using .NET Framework, it worked correclty.
]]>But I am getting a problem: Whenever I try to connect, I receive an error 400 from the server:
System.Net.WebException: ‘The remote server returned an error: (400) Bad Request.’
This exception was originally thrown at this call stack:
System.Net.HttpWebRequest.GetResponse()
Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate()
Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()
Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
CSOM_SharePoint.Program.Main(string[]) in Program.cs
Any idea on how to solve this?
Thank you in advance
]]>