Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to load 2Mb+ files #7

Closed
avishnyakov opened this issue May 28, 2014 · 2 comments
Closed

Add ability to load 2Mb+ files #7

avishnyakov opened this issue May 28, 2014 · 2 comments
Assignees
Milestone

Comments

@avishnyakov
Copy link
Contributor

Currently CSOM allows to upload only < 2Mb files. Not cool, REST should be used.

@avishnyakov avishnyakov added this to the 2014.06 milestone May 28, 2014
@avishnyakov avishnyakov modified the milestones: 2014.07, 2014.06 Jun 20, 2014
@avishnyakov
Copy link
Contributor Author

Test with CSOM and http://mysharepointlearnings.wordpress.com/2014/06/30/provider-hosted-app-upload-large-files-using-csom/
https://gist.github.com/garima2510/b1167e611ffb495848ec#file-uploadfilelarge-cs

var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext, SPHostUrl);

using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
{
    if (clientContext != null)
    {
        //file is uploaded file. Could be read from Request.Files
        using (FileStream fs = new FileStream(file.FileName, FileMode.Open))
        {
            //code for file size > 2MB. tested upto 50MB
            FileCreationInformation newFile = new FileCreationInformation();
            newFile.ContentStream = fs;
            newFile.Url = Path.GetFileName(file.FileName);
            newFile.Overwrite = true;

            List docs = clientContext.Web.Lists.GetByTitle("List_Name");
            Microsoft.SharePoint.Client.File uploadFile = docs.RootFolder.Files.Add(newFile);
            clientContext.Load(uploadFile);
            clientContext.ExecuteQuery();
        }
    }
}

@avishnyakov avishnyakov modified the milestones: 2014.08, 2014.07 Jul 4, 2014
@SubPointSupport SubPointSupport self-assigned this Aug 8, 2014
@SubPointSupport
Copy link
Contributor

Covered with SPMeta2.Regression.Tests.Impl.Scenarios.ModuleFileScenariousTest implementation for 1, 5, 15, 25 and 50Mb generated files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants