![](/img/trans.png)
[英]How can I upload files into a shared folder on OneDrive using OneDrive 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;
有人可以幫助我完成下一步嗎?
以下是獲取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.