문제

사용자 OneDrive에서 "녹음 된"폴더 안에있는 모든 ".wav"파일을 다운로드해야합니다.이 코드를 사용하고 있지만 다운로드 한 파일은 0KB입니다.이 코드에서 오류를 찾을 수 없습니다.

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);
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top