我完成了将我的应用程序与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);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句