I'm attempting to use CSOM against my on-premises SharePoint 2016 server to return the contents of a list using the following code:

var context = new ClientContext("https://sharepoint");
context.Credentials = CredentialCache.DefaultNetworkCredentials;

var list = context.Web.Lists.GetByTitle("MyList");

On context.ExecuteQuery(), I get a 400 Bad Request every time. When viewing the log for this request, I get the following:

Name=Request (POST:https://sharepoint/testing/_vti_bin/sites.asmx:GetUpdatedFormDigestInformation)
SPRequestModule.BeginRequestHandler End
ObjectCachePerRequest Global:True, Enabled:False
Using input cookie name. CookieName: 'FedAuth'.
Medium  SPSite as SystemAccount:
Token is for a windows account.
The audience uri loads a web application matches. AudienceUri: 'https://sharepoint/testing/_vti_bin/sites.asmx', InputWebApplicationId: 'b11522b6-79fa-4263-ae7a-834b932189cb', InputUrlZone: 'Default'.
The absolute uri validation succeeded. AudienceUri: 'https://sharepoint/testing/_vti_bin/sites.asmx'.
SPApplicationAuthenticationModule: Clear outgoing token context from SpThreadContext
SPRequestModule.PostAuthenticateRequestHandler Begin
Looking up SPSite by ID e6ed9222-8ae1-4156-b137-d8a051fc9300 in memory.
Non-OAuth request. IsAuthenticated=True, 
UserIdentityName=0#.w|pad\valid.user, ClaimsCount=44
Value for isAnonymousAllowed is : False
Value for checkAuthenticationCookie is : True
SPRequestModule.PostAuthenticateRequestHandler End
SPRequestModule.PostAuthorizeRequestHandler Begin
SPRequestModule.PostResolveRequestCacheHandler Begin
SPRequestModule.PostResolveRequestCacheHandler End
SPRequestModule.PostAcquireRequestStateHandler Begin
SPRequestModule.PostAcquireRequestStateHandler End
SPRequestModule.PreRequestExecuteAppHandler Begin
SPRequestModule.PreRequestExecuteAppHandler End
SPRequestModule.PostLogRequestHandler Begin
SPRequestModule.PostLogRequestHandler End
SPRequestModule.EndRequestHandler Begin
Looking up SPSite by ID e6ed9222-8ae1-4156-b137-d8a051fc9300 in memory.
SPRequestModule.PreSendRequestHeaders End
Micro Trace Tags: 0 avwhy,0 nasq,0 az4z8,0 avwhz,11 aytib,0 bjkuz,1 a7r51,0 a1n25,0 a9fy7,0 a9fy6,0 bjvyg,0 avwh6,1 az4z8,0 agb9s,0 ajd6k,0 ajd6l,1 avwh7,0 avwh8,0 avwh0,0 avwh1,0 aj1kn,0 avwh2,0 avwh3,0 avwhu,0 avwhv,0 avwia,0 avwib,0 avwic,0 az4z8,0 avwh5
Sending HTTP response 400 for HTTP request POST to https://sharepoint/_vti_bin/sites.asmx
Leaving Monitored Scope: (Request (POST:https://sharepoint/testing/_vti_bin/sites.asmx:GetUpdatedFormDigestInformation)) Execution Time=22.5760536765152; CPU Milliseconds=10; SQL Query Count=0;Parent=None
SPRequestModule.EndRequestHandler End

There are also no errors in the Windows Event log. Can anyone suggest why I may be getting this error or how I find out what's going on?


Apparently Sharepoint 2016 CSOM doesn't work with .Net Core which is where I was attempting to use it.

| improve this answer | |
  • What was your workaround, directly calling the REST API? – Shihan Mar 21 '19 at 14:17
  • While I'm sure that would be one workaround, I just backed off and created a .net project instead of .net core. – DrewB Mar 25 '19 at 11:27
  • this solved the problem – wsbaser Aug 3 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.