C# 从OneDrive下载.wav文件
我需要下载用户OneDrive上名为“Recorded”的文件夹中的所有“.wav”文件。我正在使用此代码,但下载的文件为0 kb。我找不到此代码中的错误C# 从OneDrive下载.wav文件,c#,windows-phone-8,onedrive,C#,Windows Phone 8,Onedrive,我需要下载用户OneDrive上名为“Recorded”的文件夹中的所有“.wav”文件。我正在使用此代码,但下载的文件为0 kb。我找不到此代码中的错误 LiveOperationResult operationResult = await client.GetAsync(folderId + "/files"); var iEnum = operationResult.Result.Values.GetEnumerator();
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);