繁体   English   中英

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

[英]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;

有人可以帮助我完成下一步吗?

以下是获取app文件夹的方法:

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

上传将像这样工作:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM