public Response DownloadFilesFromAzure(List<string> fileNameList, string folderPath) { response = new Response(); try { string azureConnectionStrig = "DefaultEndpointsProtocol=https;AccountName=" + storageConfig.AccountName + ";AccountKey=" + storageConfig.AccesssKey; storageAcc = CloudStorageAccount.Parse(azureConnectionStrig); blobClient = storageAcc.CreateCloudBlobClient(); container = blobClient.GetContainerReference(storageConfig.AccountName); // BlobName : storageConfig.AccountName foreach (var blobitem in fileNameList) { var blobItems = container.ListBlobs(blobitem).ToList(); blockBlob = container.GetBlockBlobReference(blobItems[0].Uri.ToString()); var fileName = blockBlob.Name.Substring(blockBlob.Name.LastIndexOf('/') + 1); blockBlob.BeginDownloadToFile(Path.Combine(folderPath, fileName), FileMode.OpenOrCreate, null, null); //Task task = Task.Run(()=> blockBlob.BeginDownloadToFile(Path.Combine(folderPath, fileName), FileMode.OpenOrCreate, null, null)); //task.Wait(); } // here my method to zip & move file ZipAndMove(); response.ErrorCode = ErrorCode.Success; return response; } catch (Exception e) { Logging.Log(e.Message, 20, true); throw e; } }
//Task task = Task.Run(()=> blockBlob.BeginDownloadToFile(Path.Combine(folderPath, fileName), FileMode.OpenOrCreate, null, null)); //task.Wait();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)