method to create (or change) file in SharePoint 2010, you can get "The remote server returned an error: (400) Bad Request" error.
To resolve this issue you need to change default Maximum Message Size for WCF calls:
open SharePoint 2010 Management Shell
type:
$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = your_value
$ws.Update()
I recommend to set MaxReceivedMessageSize to Int32.MaxValue - 1 (2147483646).
Sometimes you may need to run "iisreset /noforce" to enforce changes applying.
Also you can use Microsoft.SharePoint.Client.File.SaveBinaryDirect approach that does not have this limitation.
Well Does FileCollection.Add is useful uploading file to sharepoint online?
ReplyDeleteAs I got error related as described above? i dont think we are allowed to change value as you have described above. Is there any solution in case of sharepoint online?
Hi
ReplyDeleteVery very helpful thank you! Worked a treat!
ReplyDeleteThank You So Much..
ReplyDeletereally working like a charm
I am glad that it is still useful :)
ReplyDelete