1
私はXamarinアプリケーションのUWPの一部とOnedrive SDKを統合しています。私は、ダウンロードボタンを押すと、私はOnedriveサインインページを取得しますが、それは、この行で、上記のエラーがスローされます。ここ私はinvalidRequest例外がスローされます:mscorlib.ni.dllの 'Microsoft.Graph.ServiceException'
try
{
var appFolder = await OneDriveClient.Drive.Special.AppRoot.Request().GetAsync();
Debug.WriteLine(appFolder.Name);
}
catch (ServiceException e )
{
Debug.WriteLine(e.Message +" " + e.Error.Code);
}
がいっぱい関連するコードです:
public async Task Download(string filename)
{
//AccountSelectionLoaded();
await InitializeClient();
try
{
var appFolder = await OneDriveClient.Drive.Special.AppRoot.Request().GetAsync();
Debug.WriteLine(appFolder.Name);
}
catch (ServiceException e )
{
Debug.WriteLine(e.Message +" " + e.Error.Code);
}
var file = await OneDriveClient.Drive.Special.AppRoot.Children[filename].Content.Request().GetAsync();
//var fileStream = await fileBuilder.Content.Request().GetAsync();
IStorageFile appFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("test.db3",
CreationCollisionOption.OpenIfExists);
byte[] fileBytes;
using (DataReader reader = new DataReader(file.AsInputStream()))
{
fileBytes = new byte[file.Length];
await reader.LoadAsync((uint)file.Length);
reader.ReadBytes(fileBytes);
}
Debug.WriteLine(fileBytes.Length);
Debug.WriteLine("Writing");
await FileIO.WriteBytesAsync(appFile, fileBytes);
Debug.WriteLine("End of writing");
}
private async Task InitializeClient()
{
if (OneDriveClient == null)
{
Task authTask;
var msaAuthProvider = new MsaAuthenticationProvider(oneDriveConsumerClientId,oneDriveConsumerReturnUrl,scopes);
await msaAuthProvider.AuthenticateUserAsync();
OneDriveClient = new OneDriveClient(oneDriveConsumerBaseUrl, msaAuthProvider);
AuthenticationProvider = msaAuthProvider;
}
}
私はこれに取り組んでいます –
更新情報?私の答えをチェックしましたか? –