Upgrading from 4.x to .NET 5

Copper Contributor

I am upgrading a .NET 4.x applicaiton to .NET 5 and when I use the same code to load context web I receive an http 400 bad request.

 

After doing some searching I see examples using REST API instead of using Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime dll.

 

For example the following code in 4.x works but fails in the .NEt 5 project

var context = new ClientContext("https://companyurl/sites/research/");
Web web = context.Web;
context.Load(web);

context.ExecuteQuery();

 

I tried pulling down a different version of the libraries from Nuget but still the same error.

 

Is there something else I can do to get the code to work with .NET 5 ?

 

Thanks,

 

 

0 Replies