我正在创建一个 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。任何答案都会非常有帮助,提前致谢
牧羊人nacy