# Class ResumableUpload&lt;TRequest&gt; (1.73.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.73.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload-1)
- [1.69.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.69.0/Google.Apis.Upload.ResumableUpload-1)
- [1.68.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Upload.ResumableUpload-1)
- [1.60.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Upload.ResumableUpload-1)
- [1.59.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Upload.ResumableUpload-1)
- [1.55.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Upload.ResumableUpload-1)
- [1.50.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Upload.ResumableUpload-1)

    public class ResumableUpload<TRequest> : ResumableUpload

Media upload which uses Google's resumable media upload protocol to upload data.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [ResumableUpload](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload) \> ResumableUpload\<TRequest\>

## Inherited Members

[ResumableUpload.MinimumChunkSize](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_MinimumChunkSize) [ResumableUpload.DefaultChunkSize](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_DefaultChunkSize) [ResumableUpload.CreateFromUploadUri(Uri, Stream, ResumableUploadOptions)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_CreateFromUploadUri_System_Uri_System_IO_Stream_Google_Apis_Upload_ResumableUploadOptions_) [ResumableUpload.Options](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_Options) [ResumableUpload.ContentStream](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_ContentStream) [ResumableUpload.chunkSize](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_chunkSize) [ResumableUpload.ChunkSize](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_ChunkSize) [ResumableUpload.ProgressChanged](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_ProgressChanged) [ResumableUpload.UploadStreamInterceptor](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_UploadStreamInterceptor) [ResumableUpload.GetProgress()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_GetProgress) [ResumableUpload.UploadSessionData](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_UploadSessionData) [ResumableUpload.Upload()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_Upload) [ResumableUpload.UploadAsync()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_UploadAsync) [ResumableUpload.UploadAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_UploadAsync_System_Threading_CancellationToken_) [ResumableUpload.Resume()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_Resume) [ResumableUpload.Resume(Uri)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_Resume_System_Uri_) [ResumableUpload.ResumeAsync()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_ResumeAsync) [ResumableUpload.ResumeAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_ResumeAsync_System_Threading_CancellationToken_) [ResumableUpload.ResumeAsync(Uri)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_ResumeAsync_System_Uri_) [ResumableUpload.ResumeAsync(Uri, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_ResumeAsync_System_Uri_System_Threading_CancellationToken_) [ResumableUpload.ProcessResponse(HttpResponseMessage)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_ProcessResponse_System_Net_Http_HttpResponseMessage_) [ResumableUpload.SendNextChunkAsync(Stream, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_SendNextChunkAsync_System_IO_Stream_System_Threading_CancellationToken_) [ResumableUpload.ExceptionForResponseAsync(HttpResponseMessage)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_ExceptionForResponseAsync_System_Net_Http_HttpResponseMessage_) [object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[ResumableUpload\<TRequest, TResponse\>](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload-2)

## Namespace

[Google.Apis.Upload](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload)

## Assembly

Google.Apis.dll

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `TRequest` | The type of the body of this request. Generally this should be the metadata related to the content to be uploaded. Must be serializable to/from JSON. |

## Remarks

See: <https://developers.google.com/drive/manage-uploads#resumable> for more information on the protocol.

## Constructors

### ResumableUpload(IClientService, string, string, Stream, string)

    protected ResumableUpload(IClientService service, string path, string httpMethod, Stream contentStream, string contentType)

Create a resumable upload instance with the required parameters.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `service` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.IClientService` The client service. |
| `path` | `https://learn.microsoft.com/dotnet/api/system.string` The path for this media upload method. |
| `httpMethod` | `https://learn.microsoft.com/dotnet/api/system.string` The HTTP method to start this upload. |
| `contentStream` | `https://learn.microsoft.com/dotnet/api/system.io.stream` The stream containing the content to upload. |
| `contentType` | `https://learn.microsoft.com/dotnet/api/system.string` Content type of the content to be uploaded. Some services may allow this to be null; others require a content type to be specified and will fail when the upload is started if the value is null. |

**Remarks** Caller is responsible for maintaining the `contentStream` open until the upload is
completed.
Caller is responsible for closing the `contentStream`.

## Properties

### Body

    public TRequest Body { get; set; }

Gets or sets the body of this request.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `TRequest` |   |

### ContentType

    public string ContentType { get; }

Gets or sets the stream's Content-Type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### HttpMethod

    public string HttpMethod { get; }

Gets or sets the HTTP method of this upload (used to initialize the upload).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Path

    public string Path { get; }

Gets or sets the path of the method (combined with
[BaseUri](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.IClientService#Google_Apis_Services_IClientService_BaseUri)) to produce
absolute Uri.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Service

    public IClientService Service { get; }

Gets or sets the service.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.IClientService` |   |

## Methods

### InitiateSessionAsync(CancellationToken)

    public override Task<Uri> InitiateSessionAsync(CancellationToken cancellationToken = default)

Initiates the resumable upload session and returns the session URI, or upload URI.
See <https://developers.google.com/drive/manage-uploads#start-resumable> and
<https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload#start-resumable> for more information.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The token to monitor for cancellation requests. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://learn.microsoft.com/dotnet/api/system.uri` | The task containing the session URI to use for the resumable upload. |

**Overrides** [ResumableUpload.InitiateSessionAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Upload.ResumableUpload#Google_Apis_Upload_ResumableUpload_InitiateSessionAsync_System_Threading_CancellationToken_)

## Extension Method

[Utilities.ThrowIfNull\<T\>(T, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)