使用 OneDrive 创建 App 文件夹并上传文件 API

Create App folder and upload file using OneDrive API

我完成了将我的应用程序与 OneDrive SDK/API 连接到我的 OneDrive。 但是我如何创建 AppFolder 并上传,即文本文件?

我设置了一个范围:

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

并对用户进行身份验证:

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

并将客户端存储在一个变量中:

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

有人可以帮助我完成后续步骤吗?

获取应用程序文件夹的方法如下:

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

上传方式如下:

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