SharePoint Error: The server does not allow messages larger than 2097152 bytes

后端 未结 4 2002
渐次进展
渐次进展 2021-02-19 09:08

I have web service that point to sharepoint 2013 Office 365. I use the client object model. I am trying to update the xml file which stores 4 attachments in it. When I do thi

4条回答
  •  青春惊慌失措
    2021-02-19 09:24

    earlier i was using this approach and getting issues for 2MB file

    var fileCreationInfo = new FileCreationInformation
                        {
    
                            Content = System.IO.File.ReadAllBytes(fileName),
                            Overwrite = true,
                            Url = Path.GetFileName(fileName)
                       };
    

    I tried to use powershell script, as mentioned on many post, to increase the limit of file size but no luck, then i followed below approach and able to upload file size 100MB.

    FileStream fs = new FileStream(fileName, FileMode.Open);
                    FileCreationInformation fileCreationInfo = new FileCreationInformation();
                    fileCreationInfo.ContentStream = fs;
                    fileCreationInfo.Url = Path.GetFileName(fileName);
                    fileCreationInfo.Overwrite = true;
    

提交回复
热议问题