Я создаю приложение UWP и хочу использовать API-интерфейс Onedrive, чтобы пользователи могли сохранять копии своих файлов в своей учетной записи 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;
}
catch (OneDriveException exception)
{
// Eating the authentication cancelled exceptions and resetting our client.
if (!exception.IsMatch(OneDriveErrorCode.AuthenticationCancelled.ToString()))
{
if (exception.IsMatch(OneDriveErrorCode.AuthenticationFailure.ToString()))
{
txtBox_Response.Text = "Authentication failed/cancelled, disposing of the client...";
((OneDriveClient)this.oneDriveClient).Dispose();
this.oneDriveClient = null;
}
else
{
// Or we failed due to someother reason, let get that exception printed out.
txtBox_Response.Text = exception.Error.ToString();
}
}
else
{
((OneDriveClient)this.oneDriveClient).Dispose();
this.oneDriveClient = null;
}
}
}
}
Я создал образец репозитория в github: Пример синхронизации файлов Onedrive
Я уже пробовал использовать Dropbox, Gdrive, но его реализация для UWP кажется гораздо более сложной, поэтому я выбрал OneDrive.любой ответ будет очень полезен заранее спасибо