{"id":1672,"date":"2014-05-09T14:09:04","date_gmt":"2014-05-09T13:09:04","guid":{"rendered":"http:\/\/www.stuartroberts.net\/?p=1672"},"modified":"2022-09-09T13:42:11","modified_gmt":"2022-09-09T12:42:11","slug":"sending-large-data-csom","status":"publish","type":"post","link":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/","title":{"rendered":"Sending large data with CSOM"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">As a follow up to my recent post showing how to create or overwrite a document using the CSOM, I&#8217;m now going to show how to upload a file containing large amounts of data. To see the original post, click <a title=\"Cannot invoke HTTP DAV request\" href=\"http:\/\/www.stuartroberts.net\/index.php\/2014\/02\/24\/cannot-invoke-http-dav-request\/\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Previously, when saving the binary data, I demonstrated the functionality with the following code:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic void SaveFile(Microsoft.SharePoint.Client.ClientContext context, string folderRelativeUrl, string relativeItemUrl, byte&#x5B;] fileData)\n{\n    var fci = new FileCreationInformation\n    {\n        Url = relativeItemUrl,\n        Content = fileData,\n        Overwrite = true\n    };\n\n    Microsoft.SharePoint.Client.Folder folder = context.Web.GetFolderByServerRelativeUrl(folderRelativeUrl);\n    Microsoft.SharePoint.Client.FileCollection files = folder.Files;\n    Microsoft.SharePoint.Client.File file = files.Add(fci);\n\n    context.Load(files);\n    context.Load(file);\n    context.ExecuteQuery();\n}\n\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The above code, by default, will be restricts to transferring files that are no more than 2091752 bytes in size, or 2MB.<br><br>To get around this, we&#8217;ll set the content for the <a title=\"FileCreationInformation class\" href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.client.filecreationinformation.aspx\" target=\"_blank\" rel=\"noopener\">FileCreationInformation<\/a> object using the ContentStream property instead of the Content property.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">As it sounds, this property accepts a Stream object instead of a byte array.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;ll also add some logic to send the file data in buffered chunks, as there&#8217;s still a limit to how much the FileCreationInformation upload can handle in one process without error. For this, I&#8217;ve set a maximum file size of 4Mb before the buffer logic kicks in.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The updated code looks like:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic void SaveFile(Microsoft.SharePoint.Client.ClientContext context, string folderRelativeUrl, string relativeItemUrl, string filename)\n{\n\t\/\/ Get the files object for the parent folder we want to upload a file to\n\tMicrosoft.SharePoint.Client.Folder folder = context.Web.GetFolderByServerRelativeUrl(folderRelativeUrl);\n\tMicrosoft.SharePoint.Client.FileCollection files = folder.Files;\n\tcontext.Load(files);\n\tcontext.ExecuteQuery();\n\n\t\/\/ 4Mb file length that will trigger a buffered upload\n\tint bufferFileSize = 4 * 1024 * 1024;\n\tlong fileLength = new FileInfo(filename).Length;\n\n\tif (fileLength &lt;= bufferFileSize)\n\t{\n\t\t\/\/ No need to buffer the upload\n\t\tusing (FileStream stream = new FileStream(filename, FileMode.Open))\n\t\t{\n\t\t\tvar fci = new FileCreationInformation\n\t\t\t{\n\t\t\t\tUrl = relativeItemUrl,\n\t\t\t\tContentStream = stream,\n\t\t\t\tOverwrite = true\n\t\t\t};\n\t\t\t\n\t\t\tMicrosoft.SharePoint.Client.File file = files.Add(fci);\n\t\t\t\n\t\t\tcontext.Load(file);\n\t\t\tcontext.ExecuteQuery();\n\t\t}\n\t}\n\telse\n\t{\n\t\t\/\/ 2Mb buffer chunks\n\t\tint blockSize = 2 * 1024 * 1024;\n\t\tMicrosoft.SharePoint.Client.File file = null;\n\t\tGuid uploadId = Guid.NewGuid();\n\n\t\tusing (FileStream stream = new FileStream(filename, FileMode.Open))\n\t\t{\n\t\t\tbyte&#x5B;] buffer = new byte&#x5B;blockSize];\n\t\t\tlong offset = 0;\n\t\t\tlong totalBytesRead = 0;\n\t\t\tint bytesRead;\n\n\t\t\t\/\/ Read data from file system in blocks.\n\t\t\twhile ((bytesRead = stream.Read(buffer, 0, buffer.Length)) &gt; 0)\n\t\t\t{\n\t\t\t\tClientResult&lt;long&gt; totalBytesSent;\n\t\t\t\ttotalBytesRead += bytesRead;\n\t\t\t\t\n\t\t\t\t\/\/ First set of data to upload\n\t\t\t\tif (file == null)\n\t\t\t\t{\n\t\t\t\t\tusing (MemoryStream emptyStream = new MemoryStream())\n\t\t\t\t\t{\n\t\t\t\t\t\tvar fci = new FileCreationInformation\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tUrl = relativeItemUrl,\n\t\t\t\t\t\t\tContentStream = emptyStream,\n\t\t\t\t\t\t\tOverwrite = true\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\/\/ Create an empty file\n\t\t\t\t\t\tfile = files.Add(fci);\n\n\t\t\t\t\t\t\/\/ Start the initial upload of data to the file\n\t\t\t\t\t\tusing (MemoryStream bufferStream = new MemoryStream(buffer))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttotalBytesSent = file.StartUpload(uploadId, bufferStream);\n\t\t\t\t\t\t\tcontext.ExecuteQuery();\n\t\t\t\t\t\t\toffset = totalBytesSent.Value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\/\/ Continue uploading this set of data\n\t\t\t\telse if (totalBytesRead &lt; fileLength)\n\t\t\t\t{\n\t\t\t\t\tusing (MemoryStream bufferStream = new MemoryStream(buffer))\n\t\t\t\t\t{\n\t\t\t\t\t\ttotalBytesSent = file.ContinueUpload(uploadId, offset, bufferStream);\n\t\t\t\t\t\tcontext.ExecuteQuery();\n\t\t\t\t\t\toffset = totalBytesSent.Value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\/\/ We&#039;ve reach the last buffered set of data to upload\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\/\/ Create byte with the final byte count\n\t\t\t\t\tvar finalBuffer = new byte&#x5B;bytesRead];\n\t\t\t\t\tArray.Copy(buffer, 0, finalBuffer, 0, bytesRead);\n\n\t\t\t\t\t\/\/ Complete the file upload\n\t\t\t\t\tusing (MemoryStream bufferStream = new MemoryStream(finalBuffer))\n\t\t\t\t\t{\n\t\t\t\t\t\tfile = file.FinishUpload(uploadId, offset, bufferStream);\n\t\t\t\t\t\tcontext.Load(file);\n\t\t\t\t\t\tcontext.ExecuteQuery();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This will result in the file creation either via buffered streaming or in one pass.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hope this helps!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a follow up to my recent post showing how to create or overwrite a document using the CSOM, I&#8217;m now going to show how to upload a file containing large amounts of data. To see the original post, click &hellip; <a href=\"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[67,3],"tags":[91,81],"class_list":["post-1672","post","type-post","status-publish","format-standard","hentry","category-csom","category-sharepoint","tag-csom","tag-sharepoint"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"How to create or overwrite large files in SharePoint with the CSOM and avoid the Cannot invoke HTTP DAV Request error when using the SaveBinaryDirect method.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Stu\"\/>\n\t<meta name=\"keywords\" content=\"sharepoint,sps,sp,http dav request,savebinarydirect,filecreationinformation,contentstream,2091752,csom\" \/>\n\t<link rel=\"canonical\" href=\"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_GB\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Stuart Roberts on all things SharePoint |\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Sending large data with CSOM | Stuart Roberts on all things SharePoint\" \/>\n\t\t<meta property=\"og:description\" content=\"How to create or overwrite large files in SharePoint with the CSOM and avoid the Cannot invoke HTTP DAV Request error when using the SaveBinaryDirect method.\" \/>\n\t\t<meta property=\"og:url\" content=\"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2014-05-09T13:09:04+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-09-09T12:42:11+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@SharePointStu\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Sending large data with CSOM | Stuart Roberts on all things SharePoint\" \/>\n\t\t<meta name=\"twitter:description\" content=\"How to create or overwrite large files in SharePoint with the CSOM and avoid the Cannot invoke HTTP DAV Request error when using the SaveBinaryDirect method.\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@SharePointStu\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#article\",\"name\":\"Sending large data with CSOM | Stuart Roberts on all things SharePoint\",\"headline\":\"Sending large data with CSOM\",\"author\":{\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/503cb376bab10c66a6bde71d1514dcab2eab4ec44a2f82ef597ca87af61bf1cd?s=96&d=retro&r=g\",\"width\":96,\"height\":96,\"caption\":\"Stu\"},\"datePublished\":\"2014-05-09T14:09:04+01:00\",\"dateModified\":\"2022-09-09T13:42:11+01:00\",\"inLanguage\":\"en-GB\",\"commentCount\":8,\"mainEntityOfPage\":{\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#webpage\"},\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#webpage\"},\"articleSection\":\"CSOM, SharePoint, CSOM, SharePoint\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.stuartroberts.net\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/category\\\/sharepoint\\\/#listItem\",\"name\":\"SharePoint\"}},{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/category\\\/sharepoint\\\/#listItem\",\"position\":2,\"name\":\"SharePoint\",\"item\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/category\\\/sharepoint\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/category\\\/sharepoint\\\/csom\\\/#listItem\",\"name\":\"CSOM\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/category\\\/sharepoint\\\/csom\\\/#listItem\",\"position\":3,\"name\":\"CSOM\",\"item\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/category\\\/sharepoint\\\/csom\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#listItem\",\"name\":\"Sending large data with CSOM\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/category\\\/sharepoint\\\/#listItem\",\"name\":\"SharePoint\"}},{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#listItem\",\"position\":4,\"name\":\"Sending large data with CSOM\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/category\\\/sharepoint\\\/csom\\\/#listItem\",\"name\":\"CSOM\"}}]},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/#person\",\"name\":\"Stu\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/503cb376bab10c66a6bde71d1514dcab2eab4ec44a2f82ef597ca87af61bf1cd?s=96&d=retro&r=g\",\"width\":96,\"height\":96,\"caption\":\"Stu\"}},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/author\\\/admin\\\/#author\",\"url\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/author\\\/admin\\\/\",\"name\":\"Stu\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/503cb376bab10c66a6bde71d1514dcab2eab4ec44a2f82ef597ca87af61bf1cd?s=96&d=retro&r=g\",\"width\":96,\"height\":96,\"caption\":\"Stu\"}},{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#webpage\",\"url\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/\",\"name\":\"Sending large data with CSOM | Stuart Roberts on all things SharePoint\",\"description\":\"How to create or overwrite large files in SharePoint with the CSOM and avoid the Cannot invoke HTTP DAV Request error when using the SaveBinaryDirect method.\",\"inLanguage\":\"en-GB\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/#website\"},\"breadcrumb\":{\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/2014\\\/05\\\/09\\\/sending-large-data-csom\\\/#breadcrumblist\"},\"author\":{\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/index.php\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2014-05-09T14:09:04+01:00\",\"dateModified\":\"2022-09-09T13:42:11+01:00\"},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/#website\",\"url\":\"http:\\\/\\\/www.stuartroberts.net\\\/\",\"name\":\"Stuart Roberts on all things SharePoint\",\"inLanguage\":\"en-GB\",\"publisher\":{\"@id\":\"http:\\\/\\\/www.stuartroberts.net\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Sending large data with CSOM | Stuart Roberts on all things SharePoint","description":"How to create or overwrite large files in SharePoint with the CSOM and avoid the Cannot invoke HTTP DAV Request error when using the SaveBinaryDirect method.","canonical_url":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/","robots":"max-image-preview:large","keywords":"sharepoint,sps,sp,http dav request,savebinarydirect,filecreationinformation,contentstream,2091752,csom","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#article","name":"Sending large data with CSOM | Stuart Roberts on all things SharePoint","headline":"Sending large data with CSOM","author":{"@id":"http:\/\/www.stuartroberts.net\/index.php\/author\/admin\/#author"},"publisher":{"@id":"http:\/\/www.stuartroberts.net\/#person"},"image":{"@type":"ImageObject","@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/503cb376bab10c66a6bde71d1514dcab2eab4ec44a2f82ef597ca87af61bf1cd?s=96&d=retro&r=g","width":96,"height":96,"caption":"Stu"},"datePublished":"2014-05-09T14:09:04+01:00","dateModified":"2022-09-09T13:42:11+01:00","inLanguage":"en-GB","commentCount":8,"mainEntityOfPage":{"@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#webpage"},"isPartOf":{"@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#webpage"},"articleSection":"CSOM, SharePoint, CSOM, SharePoint"},{"@type":"BreadcrumbList","@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/#listItem","position":1,"name":"Home","item":"http:\/\/www.stuartroberts.net\/","nextItem":{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/#listItem","name":"SharePoint"}},{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/#listItem","position":2,"name":"SharePoint","item":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/","nextItem":{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/csom\/#listItem","name":"CSOM"},"previousItem":{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/csom\/#listItem","position":3,"name":"CSOM","item":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/csom\/","nextItem":{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#listItem","name":"Sending large data with CSOM"},"previousItem":{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/#listItem","name":"SharePoint"}},{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#listItem","position":4,"name":"Sending large data with CSOM","previousItem":{"@type":"ListItem","@id":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/csom\/#listItem","name":"CSOM"}}]},{"@type":"Person","@id":"http:\/\/www.stuartroberts.net\/#person","name":"Stu","image":{"@type":"ImageObject","@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/503cb376bab10c66a6bde71d1514dcab2eab4ec44a2f82ef597ca87af61bf1cd?s=96&d=retro&r=g","width":96,"height":96,"caption":"Stu"}},{"@type":"Person","@id":"http:\/\/www.stuartroberts.net\/index.php\/author\/admin\/#author","url":"http:\/\/www.stuartroberts.net\/index.php\/author\/admin\/","name":"Stu","image":{"@type":"ImageObject","@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/503cb376bab10c66a6bde71d1514dcab2eab4ec44a2f82ef597ca87af61bf1cd?s=96&d=retro&r=g","width":96,"height":96,"caption":"Stu"}},{"@type":"WebPage","@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#webpage","url":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/","name":"Sending large data with CSOM | Stuart Roberts on all things SharePoint","description":"How to create or overwrite large files in SharePoint with the CSOM and avoid the Cannot invoke HTTP DAV Request error when using the SaveBinaryDirect method.","inLanguage":"en-GB","isPartOf":{"@id":"http:\/\/www.stuartroberts.net\/#website"},"breadcrumb":{"@id":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/#breadcrumblist"},"author":{"@id":"http:\/\/www.stuartroberts.net\/index.php\/author\/admin\/#author"},"creator":{"@id":"http:\/\/www.stuartroberts.net\/index.php\/author\/admin\/#author"},"datePublished":"2014-05-09T14:09:04+01:00","dateModified":"2022-09-09T13:42:11+01:00"},{"@type":"WebSite","@id":"http:\/\/www.stuartroberts.net\/#website","url":"http:\/\/www.stuartroberts.net\/","name":"Stuart Roberts on all things SharePoint","inLanguage":"en-GB","publisher":{"@id":"http:\/\/www.stuartroberts.net\/#person"}}]},"og:locale":"en_GB","og:site_name":"Stuart Roberts on all things SharePoint |","og:type":"article","og:title":"Sending large data with CSOM | Stuart Roberts on all things SharePoint","og:description":"How to create or overwrite large files in SharePoint with the CSOM and avoid the Cannot invoke HTTP DAV Request error when using the SaveBinaryDirect method.","og:url":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/","article:published_time":"2014-05-09T13:09:04+00:00","article:modified_time":"2022-09-09T12:42:11+00:00","twitter:card":"summary","twitter:site":"@SharePointStu","twitter:title":"Sending large data with CSOM | Stuart Roberts on all things SharePoint","twitter:description":"How to create or overwrite large files in SharePoint with the CSOM and avoid the Cannot invoke HTTP DAV Request error when using the SaveBinaryDirect method.","twitter:creator":"@SharePointStu"},"aioseo_meta_data":{"post_id":"1672","title":"Sending large data with CSOM | #site_title","description":"How to create or overwrite large files in SharePoint with the CSOM and avoid the Cannot invoke HTTP DAV Request error when using the SaveBinaryDirect method.","keywords":[{"label":"SharePoint","value":"SharePoint"},{"label":"SPS","value":"SPS"},{"label":"SP","value":"SP"},{"label":"HTTP DAV Request","value":"HTTP DAV Request"},{"label":"SaveBinaryDirect","value":"SaveBinaryDirect"},{"label":"FileCreationInformation","value":"FileCreationInformation"},{"label":"ContentStream","value":"ContentStream"},{"label":"2091752","value":"2091752"}],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"},\"blockGraphs\":[]}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"limit_modified_date":false,"created":"2021-08-03 13:46:15","updated":"2026-10-15 19:24:51","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"http:\/\/www.stuartroberts.net\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/\" title=\"SharePoint\">SharePoint<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/csom\/\" title=\"CSOM\">CSOM<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tSending large data with CSOM\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"http:\/\/www.stuartroberts.net\/"},{"label":"SharePoint","link":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/"},{"label":"CSOM","link":"http:\/\/www.stuartroberts.net\/index.php\/category\/sharepoint\/csom\/"},{"label":"Sending large data with CSOM","link":"http:\/\/www.stuartroberts.net\/index.php\/2014\/05\/09\/sending-large-data-csom\/"}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/1672","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/comments?post=1672"}],"version-history":[{"count":3,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/1672\/revisions"}],"predecessor-version":[{"id":1962,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/posts\/1672\/revisions\/1962"}],"wp:attachment":[{"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/media?parent=1672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/categories?post=1672"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.stuartroberts.net\/index.php\/wp-json\/wp\/v2\/tags?post=1672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}