Search code examples
c#windows-runtimewindows-phone-8.1onedrivelive-sdk

can't upload to OneDrive using LiveSDK from Windows Phone 8.1 RT


I am trying to upload a 1 KB file to OneDrive to an existing folder. The application is WinRT on a real Windows Phone 8.1 device.

The code is extremely simple and is taken from documentation's examples:

    var lcc = new LiveConnectClient(session);
    //https://msdn.microsoft.com/en-us/library/office/dn659730.aspx
    var r = await lcc.CreateBackgroundUploadAsync(folderId, "somefile.bin", file, OverwriteOption.Overwrite);            
    var r2 = await r.StartAsync();
    return r2;

This code is called from an async button tap event. I experience same result when using BackgroundUploadAsync (which is probably same as using top 2 methods any way).

So the StartAsync method executes, but no response is received from it, it is awaited indefinitely (it doesn't block the UI thread), no observable exceptions are thrown, and no file is uploaded.

The folderId references a real folder at OneDrive.

I didn't notice any issues with the upload file either. It exists and no applications are trying to access it.

I have no problems downloading a file from OneDrive using similar code.

That exactly same code works fine when running from a Windows Store 8.1 app. Both Windows & Windows Phone apps are using same WinRT Live SDK library. So I guess the problem is with the background transfer API which is used by Live SDK.


Solution

  • I've tried to isolate the problem in a separate application, but to no success. The same code was working fine in another project. So I've reinstalled (uninstalled and then ran it from VS2015) the application and it works fine now!