Closed mscherotter closed 2 weeks ago
I would like to know how to do this too.
Thanks Russ
I figured it out:
private static async Task<UploadOperation> BackgroundUploadAsync(
OneDriveClient oneDriveClient,
string oneDriveToken,
StorageFile file)
{
var uploader = new BackgroundUploader();
uploader.SetRequestHeader("Authorization", "bearer " + oneDriveToken);
uploader.SetRequestHeader("Content-Type", "application/octet-stream");
uploader.Method = "PUT";
var request = oneDriveClient.Drive.Special.AppRoot.ItemWithPath(file.Name).Content.Request();
var uri = new Uri(request.RequestUrl);
var operation = uploader.CreateUpload(uri, file);
return await operation.StartAsync();
}
Thank you for submitting. I like the way you got this done! However, I think this could be integrated better into the SDK. Perhaps I can some client extensions that are UWP-specific. I will add the Enhancement tag and keep this in mind for the future. Thanks!
Thank you for reaching out and for your patience. This SDK is being officially deprecated. See #259 for more information
What is the recommended way of using the OneDriveClient with the UWP BackgroundUploader class? Michael