Create app folder and upload file using OneDrive API

I have performed to connect my app with OneDrive SDK / API to my OneDrive. But how can I create an AppFolder and load the ie text file?

I set the scope:

private readonly string[] scopes = new string[] { "onedrive.readwrite", "wl.offline_access", "wl.signin" };

      

and authenticate the user:

((App)Application.Current).OneDriveClient = OneDriveClientExtensions.GetUniversalClient(this.scopes);
await ((App)Application.Current).OneDriveClient.AuthenticateAsync();

      

and store the Client in a variable:

var myOneDriveClient = ((App)Application.Current).OneDriveClient;

      

Can anyone help me with the next steps?

+3
c # onedrive


source to share


1 answer


You can get the application folder here:

var folder = await myOneDriveClient.Drive.Special.AppRoot.Request().GetAsync();

      



The download will work like this:

var item = await myOneDriveClient
    .Drive
    .Special
    .AppRoot
    .Children["filename"]
    .Content
    .Request()
    .PutAsync<Item>(contentStream);

      

+3


source to share







All Articles