OneDriveから.wavファイルをダウンロードしてください
-
21-12-2019 - |
質問
ユーザーOneDriveで "録画"という名前のフォルダ内のすべての ".wav"ファイルをダウンロードする必要があります。私はこのコードを使っていますが、ダウンロードされたファイルは0 KBです。このコードのエラーが見つかりません。
LiveOperationResult operationResult = await client.GetAsync(folderId + "/files");
var iEnum = operationResult.Result.Values.GetEnumerator();
iEnum.MoveNext();
var files = iEnum.Current as IEnumerable;
foreach (dynamic v in files)
{
var downloadOperationResult = await client.DownloadAsync(v.id as string);
using (Stream downloadStream = downloadOperationResult.Stream)
{
if (downloadStream != null)
{
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
if (!storage.DirectoryExists("Recorded")) storage.CreateDirectory("Recorded");
using (
IsolatedStorageFileStream fileToSave = storage.OpenFile("/Recorded/" + v.name as string,
FileMode.Create, FileAccess.ReadWrite))
{
downloadStream.CopyTo(fileToSave);
downloadStream.Flush();
downloadStream.Close();
}
}
}
}
}
. 解決
あなたのDownloadAsync呼び出しで "/ content"がないように見えます。
var downloadOperationResult = await client.DownloadAsync(v.id+"/content" as string);
. 所属していません StackOverflow