public static async Task Download(ShareFileClient sfClient, Item itemToDownload) { var downloadDirectory = new DirectoryInfo("DownloadedFiles"); if (!downloadDirectory.Exists) { downloadDirectory.Create(); } var downloader = sfClient.GetAsyncFileDownloader(itemToDownload); var file = System.IO.File.Open(Path.Combine(downloadDirectory.Name, itemToDownload.Name), FileMode.Create); await downloader.DownloadToAsync(file); }
public static async Task Download(ShareFileClient sfClient, Item itemToDownload) { var downloadDirectory = new DirectoryInfo("C:\\DownloadFiles"); if (!downloadDirectory.Exists) { downloadDirectory.Create(); } Console.WriteLine("Got Here 1"); var downloader = sfClient.GetAsyncFileDownloader(itemToDownload); Console.WriteLine("Got Here 2"); var file = System.IO.File.Open(Path.Combine(downloadDirectory.Name.ToString(), itemToDownload.Name), FileMode.Create); Console.WriteLine("Got Here 3"); await downloader.DownloadToAsync(file); Console.WriteLine("Got Here 4"); }