Code Monkey home page Code Monkey logo

Comments (2)

avishnyakov avatar avishnyakov commented on June 19, 2024

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();
        }
    }
}

from spmeta2.

SubPointSupport avatar SubPointSupport commented on June 19, 2024

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

from spmeta2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.