Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

How do you use OneDriveClient with UWP BackgroundUploader #187

Closed
mscherotter opened this issue Oct 28, 2016 · 4 comments
Closed

How do you use OneDriveClient with UWP BackgroundUploader #187

mscherotter opened this issue Oct 28, 2016 · 4 comments

Comments

@mscherotter
Copy link

What is the recommended way of using the OneDriveClient with the UWP BackgroundUploader class?
Michael

@RussWalton
Copy link

I would like to know how to do this too.

Thanks
Russ

@mscherotter
Copy link
Author

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

@cdmayer
Copy link
Contributor

cdmayer commented Oct 31, 2016

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!

@baywet
Copy link
Member

baywet commented Oct 2, 2024

Thank you for reaching out and for your patience. This SDK is being officially deprecated. See #259 for more information

@baywet baywet closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants