DriveClientDownloadFileAsync(File, String, ActionIDownloadProgress, CancellationToken) Method
Asynchronously downloads the specified file.
Namespace: DevCase.ThirdParty.Google.DriveAssembly: DevCase.net48.ThirdParty.GoogleServices (in DevCase.net48.ThirdParty.GoogleServices.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public Task<IDownloadProgress> DownloadFileAsync(
File srcFile,
string dstFilePath,
Action<IDownloadProgress> progressHandler,
CancellationToken cancellationToken
)
Public Function DownloadFileAsync (
srcFile As File,
dstFilePath As String,
progressHandler As Action(Of IDownloadProgress),
cancellationToken As CancellationToken
) As Task(Of IDownloadProgress)
Dim instance As DriveClient
Dim srcFile As File
Dim dstFilePath As String
Dim progressHandler As Action(Of IDownloadProgress)
Dim cancellationToken As CancellationToken
Dim returnValue As Task(Of IDownloadProgress)
returnValue = instance.DownloadFileAsync(srcFile,
dstFilePath, progressHandler, cancellationToken)
public:
Task<IDownloadProgress^>^ DownloadFileAsync(
File^ srcFile,
String^ dstFilePath,
Action<IDownloadProgress^>^ progressHandler,
CancellationToken cancellationToken
)
member DownloadFileAsync :
srcFile : File *
dstFilePath : string *
progressHandler : Action<IDownloadProgress> *
cancellationToken : CancellationToken -> Task<IDownloadProgress>
No code example is currently available or this language may not be supported.
- srcFile File
-
The source file to download.
- dstFilePath String
-
The destination file path where to save the downloaded file.
- progressHandler ActionIDownloadProgress
-
A event handler that will receive progress changes of the download operation.
- cancellationToken CancellationToken
-
A cancellation token to cancel the download operation.
TaskIDownloadProgress
The resulting
TaskTResult.
This is a code example.
No code example is currently available or this language may not be supported.
Dim client As New DriveClient("C:\GoogleSecrets.json", "yourmail@gmail.com", DriveScopes.Full Or DriveScopes.Metadata)
Dim credential As UserCredential = Await client.AuthorizeAsync()
Dim file As Google.Apis.Drive.v3.Data.File = Await client.GetFileByIdAsync(" File Id. ")
Dim progress As Google.Apis.Download.IDownloadProgress =
Await client.DownloadFileAsync(srcFile, dstFile, AddressOf Me.Download_ProgressChanged, Nothing)
Public Sub Download_ProgressChanged(ByVal e As Google.Apis.Download.IDownloadProgress)
Select Case e.Status
Case Google.Apis.Download.DownloadStatus.NotStarted
Console.WriteLine("Starting download...")
Case Google.Apis.Download.DownloadStatus.Downloading
Console.WriteLine("Bytes downloaded: {0}", e.BytesDownloaded)
Case Google.Apis.Download.DownloadStatus.Completed
Console.WriteLine("Download completed.")
Case Google.Apis.Download.DownloadStatus.Failed
Console.WriteLine("Download failed. Reason: {0}", e.Exception.Message)
Case Else
' Do Nothing.
End Select
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.