locked
Unable to upload files to OneDrive For Business more than 50MB using My Files REST API since 11th Nov RRS feed

  • Question

  • Hi,

    I am trying to upload files to OneDrive For Business using C# consuming Office 365 (My Files) REST API. I am able to upload files size < 50MB but for larger files it simply creates the blank file but doesn't upload the stream, and it doesn't even throw me any exception, not even timeout issue. This issue is happening from yesterday only. Before that (on 10th Nov'15) 18:00 IST, I was able to upload around 1.3GB file successfully. If I try to upload file directly (without code) its working. Please find below the code snippet I am using:

     private async Task UploadStream(string fileName, IItem parentItem, Stream stream)
            {
                IItem iItem = null;
                try
                {
                    //If the file is already exist then delete the file and create a new file. 
                    iItem = await sharePointClient.Files.GetById(parentItem.Id).ToFolder().Children.GetByPathAsync(IncrementFolderPath +"//" +  fileName);
                    await iItem.DeleteAsync();
                }
                catch (ODataErrorException)
                {
                    // fail silently the file doesn’t exist
                }

                Microsoft.Office365.SharePoint.FileServices.File newFile = new Microsoft.Office365.SharePoint.FileServices.File
                {
                    Name = fileName

                };
                await sharePointClient.Files.GetById(parentItem.Id).ToFolder().Children.AddItemAsync(newFile);
                await sharePointClient.Files.GetById(newFile.Id).ToFile().UploadAsync(stream);
            }

    Is it an temporary issue or maintenance window, can anyone please help me with this?

    Thanks In Advance!

    Regards

    Sheetal.

    Monday, November 16, 2015 4:30 AM

Answers

  • Finally could figure it out!!

    Microsoft has suddenly deprecated My Files REST API and this was updated on their site documentation a week later the changes we made in actual.

    Now the My Files REST API is restricted to 250MB of file to be uploaded via C# code (atleast as of today). And this limit is still not mentioned anywhere in Microsoft Site. This is what I could find out until now.

    • Marked as answer by Sheetal Lomate Thursday, December 10, 2015 1:34 PM
    Thursday, December 10, 2015 1:34 PM

All replies

  • Please refer to the below given threads might helps you to get in detailed:

    Office 365 Files REST API and chunked upload

    Multiple File Upload With Metadata Using REST
    Uploading Files Using the REST API.
    Upload files using REST API in SharePoint 2013

    You may also take help from Office 365 forum

    Hope this helps you!


    Easily migrate anything from Office 365, File Servers, Public Folders, OneDrive and SharePoint to SharePoint Online easily with Lepide SharePoint Migrator.

    Tuesday, November 17, 2015 5:53 AM
  • I have used the Files REST API via SDK

    https://msdn.microsoft.com/en-us/office/office365/api/files-rest-operations#FileoperationsCreateafilewithcontentREST

    And this code was working a week before, I was able to upload around 1.5GB of data from C# code. Since 1 week, I am not able to upload file more than 50MB, neither it throws any exception, it simply creates a file with 0KB. For less than 50MB files, even now its working.

    I had also posted the issue with Office 365 Community forum, and they have suggested to post the issue on this forum.

    https://community.office365.com/en-us/f/172/t/418407

    I want to know that is there any  change in api level or is it a restriction on OneDrive For Business upto 50MB via code.
    Wednesday, November 18, 2015 2:46 PM
  • Finally could figure it out!!

    Microsoft has suddenly deprecated My Files REST API and this was updated on their site documentation a week later the changes we made in actual.

    Now the My Files REST API is restricted to 250MB of file to be uploaded via C# code (atleast as of today). And this limit is still not mentioned anywhere in Microsoft Site. This is what I could find out until now.

    • Marked as answer by Sheetal Lomate Thursday, December 10, 2015 1:34 PM
    Thursday, December 10, 2015 1:34 PM