Google Drive SDK: Cancel Download

How to cancel a file upload request using Google Drive SDK?

I am creating a .NET 4 task that calls

FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, body.MimeType);
request.Upload();

I cannot use the cancel marker here to cancel my task, and I cannot find any method to cancel the request. How to stop the boot process? \

Update

Hello? Is anyone

0
source share
1 answer

Google - "". , happy housewives club forum . , , , , , . , Google. , Google Drive SDK Stack Overflow. .

, .

.NET framework 4.0 Src\GoogleApis\Apis\Upload\ResumableUpload.cs CancellationToken token Upload.

do
{
    token.ThrowIfCancellationRequested(); // <----------------------
    bytesSent += SendChunk(contentStream, url, bytesSent);
    UpdateProgress(UploadStatus.Uploading, bytesSent);
} while (bytesSent < contentStream.Length);

​​ .

, Upload,

public void Upload()
{
    Upload(new CancellationTokenSource().Token);
}

.

+2

Source: https://habr.com/ru/post/1525569/


All Articles