getting error on Azure server when trying to download more than 1 file from box.com
I am getting this error below when trying to download more than 1 file from box.com using c# code.
Here is my code:
var config = new BoxConfig(CLIENT_ID, "", uri);
var session = new BoxJWTAuth(config);
var client = session.AdminClient(apptoken);
var folderId = ConfigurationManager.AppSettings["FolderID"]; // "0";//
var folder = await client.FoldersManager.GetInformationAsync(folderId);
folderName = folder.Name;
var localFolderPath = Path.Combine(downloadFolderName, folderName);
ResetLocalFolder(localFolderPath);
var items = await client.FoldersManager.GetFolderItemsAsync(folderId, 1000, autoPaginate: true);
var fileDownloadTasks = new List();
var files = items.Entries.Where(i => i.Type == "file").ToList();
foreach (var file in files)
{
var t = await client.FilesManager.DownloadAsync(file.Id);
using (var localFile = File.Create(Path.Combine(localFolderPath, file.Name.Replace(":", ""))))
{
t.CopyTo(localFile);
}
}
foreach (var file in files)
{
fileDownloadTasks.Add(client.FilesManager.DeleteAsync(file.Id));
}
await Task.WhenAll(fileDownloadTasks);
Here is the error i get.
One or more errors occurred. at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
-
Hi ,
Is there anything more in the stack trace about the error (e.g. like so)? That should help us get down to the crux of what the problem may be.
Thanks,
Jon
サインインしてコメントを残してください。
コメント
1件のコメント