当你在使用Microsoft.SharePoint.Client.FileCollection.Add方法或Microsoft.SharePoint.Client.File.SaveBinary方法向SharePoint Library中创建或修改文件时,可能会遇到"The remote server returned an error: (400) Bad Request"的错误。要解决这个问题,你需要修改SharePoint默认的Maximum Message Size

  打开SharePoint 2010 Management Shell然后执行下面的命令:

$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = your_value 
$ws.Update()

  推荐将MaxReceivedMessageSize的大小设置为Int32.MaxValue - 1,也就是2147483646.

  通常情况下你可能需要强制重启你的IIS服务,可以使用下面的命令:

iisreset /noforce

   或者,你还可以使用Microsoft.SharePoint.Client.File.SaveBinaryDirect方法来上传文件,该方法不存在这种文件大小的限制。具体的使用方法可以参考我的另一篇文章“有关SharePoint Client Object应用的笔记”。

相关文章:

  • 2021-07-28
  • 2021-12-24
  • 2022-01-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2022-01-14
  • 2021-12-17
  • 2021-08-07
相关资源
相似解决方案