0

I'm working on existing web application where users fill out some forms and upload files. When the application is submitted the files are synced with SharePoint site. The upload code is below.

// Upload files to the Document Set.
for (int i = 0; i < originalPathAndFileNames.Count; i++)
{
    string targetLocation = string.Format("{0}/{1}/{2}/{3}", web.ServerRelativeUrl, libraryName, documentSetName, newFileNames[i]);
    using (var fs = new System.IO.FileStream(originalPathAndFileNames[i], System.IO.FileMode.Open))
    {
        Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, targetLocation, fs, true);
    }
}

However, sometimes all files are uploaded to SharePoint, sometimes none, and sometimes only some of them. And this happens randomly. SharePoint is located on a different server than the web app, so I'm suspecting the problem could be with the transfer over HTTP.

Any ideas on how to solve this problem? Thanks.

4

0 回答 0