OneDrive / onedrive-sdk-csharp

OneDrive SDK for C#! https://dev.onedrive.com
Other
295 stars 145 forks source link

Not able to upload files to my OneDrive #248

Closed miroppb closed 2 years ago

miroppb commented 5 years ago

Started happening a few weeks ago, but I didn't think much of it. Finally deciding to figure out why it's failing, but can't find any updated information.

I sign into my OneDrive with

string[] scopes = { "onedrive.readwrite", "wl.offline_access", "wl.signin" };
var msaAuthenticationProvider = new MsaAuthenticationProvider("appID", "redirect", scopes);
await msaAuthenticationProvider.AuthenticateUserAsync();
var adalAuthenticationProvider = new AdalAuthenticationProvider("appID","redirect");
var authTask = msaAuthenticationProvider.RestoreMostRecentFromCacheOrAuthenticateUserAsync();
this.oneDriveClient = new OneDriveClient("https://api.onedrive.com/v1.0", msaAuthenticationProvider);

No problem.

I'm able to pull an ID of the folder to which I'm trying to upload to with this, then going through the items until I find the right one

var item = await oneDriveClient.Drive.Root.Children.Request().GetAsync();

Easy-peasy

Then I try to upload a file to that folder

var stream = GetFileStreamForUpload(filename)
var session = await oneDriveClient.Drive.Root.ItemWithPath(Path.GetFileName(filename)).CreateSession().Request().PostAsync();
var provider = new ChunkedUploadProvider(session, oneDriveClient, stream);
var uploadedItem = await provider.UploadAsync();

And this is where it gets to the session line, and then just breaks out of my method. No crash, no exception, just stops.

Any help would be greatly appreciated