亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

UWP - 如何在 C# 中使用 OneDrive API 同步文件

UWP - 如何在 C# 中使用 OneDrive API 同步文件

PHP
蠱毒傳說 2024-01-20 21:04:26
我正在創建一個 UWP 應用程序,我想使用 Onedrive API,以便用戶可以在其 Onedrive 帳戶中保存文件的副本,但我不明白,到目前為止我只成功登錄了我想要的內容:上傳文件下載文件如果其中任何一個被修改,則進行同步創建文件夾刪除文件此代碼實現了登錄,但我無法超越此,就像繼續上傳文件或下載文件一樣 private async void btn_Login_Click(object sender, RoutedEventArgs e)        {            if (this.oneDriveClient == null)            {                try                {                    // Setting up the client here, passing in our Client Id, Return Url,                     // Scopes that we want permission to, and building a Web Broker to                     // go do our authentication.                     this.oneDriveClient = await OneDriveClient.GetAuthenticatedMicrosoftAccountClient(                        clientId,                        returnUrl,                        scopes,                        webAuthenticationUi: new WebAuthenticationBrokerWebAuthenticationUi());                   // Show in text box that we are connected.                   txtBox_Response.Text = "We are now connected";                    // We are either just autheticated and connected or we already connected,                     // either way we need the drive button now.                    btn_GetDriveId.Visibility = Visibility.Visible;                }我在 github 中創建了一個示例存儲庫:Onedrive Sync Files Sample我已經嘗試過使用 Dropbox、Gdrive,但它在 UWP 上的實現似乎要復雜得多,所以我選擇了 OneDrive。任何答案都會非常有幫助,提前致謝
查看完整描述

1 回答

?
牧羊人nacy

TA貢獻1862條經驗 獲得超7個贊

如何在 C# 中使用 OneDrive API 同步文件

對于使用 OneDrive,我們建議您使用Windows 社區工具包中的OneDrive服務來實現 OneDrive功能。

入門

要使用 OneDrive API,您需要擁有一個訪問令牌,用于對您的應用程序進行身份驗證,以獲得用戶的一組特定權限。在本節中,您將學習如何:

  1. 注冊您的應用程序以獲取客戶端 ID 和客戶端密鑰。

  2. 使用令牌流或代碼流將用戶登錄到具有指定范圍的 OneDrive。

  3. 將用戶注銷(可選)。

查看完整回答
反對 回復 2024-01-20
  • 1 回答
  • 0 關注
  • 203 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號