AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Returns information about the GetObject response and response metadata.
Namespace: Amazon.S3.Model
Assembly: AWSSDK.S3.dll
Version: 3.x.y.z
public class GetObjectResponse : StreamResponse IDisposable
The GetObjectResponse type exposes the following members
Name | Description | |
---|---|---|
![]() |
GetObjectResponse() |
Name | Type | Description | |
---|---|---|---|
![]() |
AcceptRanges | System.String |
Gets and sets the AcceptRanges. |
![]() |
BucketKeyEnabled | System.Boolean |
Gets and sets the property BucketKeyEnabled. Indicates whether the object uses an S3 Bucket Key for server-side encryption with Amazon Web Services KMS (SSE-KMS). |
![]() |
BucketName | System.String |
Gets and sets the BucketName property. |
![]() |
ChecksumCRC32 | System.String |
Gets and sets the property ChecksumCRC32. The base64-encoded, 32-bit CRC32 checksum of the object. |
![]() |
ChecksumCRC32C | System.String |
Gets and sets the property ChecksumCRC32C. The base64-encoded, 32-bit CRC32C checksum of the object. |
![]() |
ChecksumSHA1 | System.String |
Gets and sets the property ChecksumSHA1. The base64-encoded, 160-bit SHA-1 digest of the object. |
![]() |
ChecksumSHA256 | System.String |
Gets and sets the property ChecksumSHA256. The base64-encoded, 256-bit SHA-256 digest of the object. |
![]() |
ContentLength | System.Int64 | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
![]() |
ContentRange | System.String |
Gets and sets the ContentRange. |
![]() |
DeleteMarker | System.String |
Specifies whether the object retrieved was (true) or was not (false) a Delete Marker. If false, this response header does not appear in the response. |
![]() |
ETag | System.String |
An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL |
![]() |
Expiration | Amazon.S3.Model.Expiration |
Gets and sets the Expiration property. Specifies the expiration date for the object and the rule governing the expiration. Is null if expiration is not applicable. |
![]() |
Expires | System.DateTime |
The date and time at which the object is no longer cacheable. |
![]() |
Headers | Amazon.S3.Model.HeadersCollection |
The collection of headers for the request. |
![]() |
HttpStatusCode | System.Net.HttpStatusCode | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
![]() |
Key | System.String |
Gets and sets the Key property. |
![]() |
LastModified | System.DateTime |
Last modified date of the object |
![]() |
Metadata | Amazon.S3.Model.MetadataCollection |
The collection of meta data for the request. |
![]() |
MissingMeta | System.Int32 |
This is set to the number of metadata entries not returned in x-amz-meta headers. This can happen if you create metadata using an API like SOAP that supports more flexible metadata than the REST API. For example, using SOAP, you can create metadata whose values are not legal HTTP headers. |
![]() |
ObjectLockLegalHoldStatus | Amazon.S3.ObjectLockLegalHoldStatus |
Gets and sets the property ObjectLockLegalHoldStatus. |
![]() |
ObjectLockMode | Amazon.S3.ObjectLockMode |
Gets and sets the property ObjectLockMode. The Object Lock mode currently in place for this object. |
![]() |
ObjectLockRetainUntilDate | System.DateTime |
Gets and sets the property ObjectLockRetainUntilDate. The date and time when this object's Object Lock will expire. |
![]() |
PartsCount | System.Nullable<System.Int32> |
The number of parts this oject has. |
![]() |
ReplicationStatus | Amazon.S3.ReplicationStatus |
The status of the replication job associated with this source object. |
![]() |
RequestCharged | Amazon.S3.RequestCharged |
If present, indicates that the requester was successfully charged for the request. |
![]() |
ResponseMetadata | Amazon.Runtime.ResponseMetadata | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
![]() |
ResponseStream | System.IO.Stream | Inherited from Amazon.S3.Model.StreamResponse. |
![]() |
RestoreExpiration | System.Nullable<System.DateTime> |
Gets and sets the RestoreExpiration property. RestoreExpiration will be set for objects that have been restored from Amazon Glacier. It indiciates for those objects how long the restored object will exist. |
![]() |
RestoreInProgress | System.Boolean |
Gets and sets the RestoreInProgress Will be true when the object is in the process of being restored from Amazon Glacier. |
![]() |
ServerSideEncryptionCustomerMethod | Amazon.S3.ServerSideEncryptionCustomerMethod |
The Server-side encryption algorithm to be used with the customer provided key. |
![]() |
ServerSideEncryptionKeyManagementServiceKeyId | System.String |
The id of the AWS Key Management Service key that Amazon S3 uses to encrypt and decrypt the object. If present, specifies the ID of the Amazon Web Services Key Management Service (Amazon Web Services KMS) symmetric customer managed key that was used for the object. |
![]() |
ServerSideEncryptionMethod | Amazon.S3.ServerSideEncryptionMethod |
The Server-side encryption algorithm used when storing this object in S3. |
![]() |
StorageClass | Amazon.S3.S3StorageClass |
The class of storage used to store the object. |
![]() |
TagCount | System.Int32 |
The number of tags, if any, on the object. |
![]() |
VersionId | System.String |
Version of the object. |
![]() |
WebsiteRedirectLocation | System.String |
If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. |
Name | Description | |
---|---|---|
![]() |
Dispose() | Inherited from Amazon.S3.Model.StreamResponse. |
![]() |
WriteResponseStreamToFile(string) |
Writes the content of the ResponseStream a file indicated by the filePath argument. |
![]() |
WriteResponseStreamToFile(string, bool) |
Writes the content of the ResponseStream a file indicated by the filePath argument. |
![]() |
WriteResponseStreamToFileAsync(string, bool, CancellationToken) |
Writes the content of the ResponseStream a file indicated by the filePath argument. |
Name | Description | |
---|---|---|
![]() |
WriteObjectProgressEvent |
This example shows how to get an object.
// Create a client AmazonS3Client client = new AmazonS3Client(); // Create a GetObject request GetObjectRequest request = new GetObjectRequest { BucketName = "SampleBucket", Key = "Item1" }; // Issue request and remember to dispose of the response using (GetObjectResponse response = client.GetObject(request)) { using (StreamReader reader = new StreamReader(response.ResponseStream)) { string contents = reader.ReadToEnd(); Console.WriteLine("Object - " + response.Key); Console.WriteLine(" Version Id - " + response.VersionId); Console.WriteLine(" Contents - " + contents); } }
This example shows how to get an object and write it to a local file.
// Create a client AmazonS3Client client = new AmazonS3Client(); // Create a GetObject request GetObjectRequest request = new GetObjectRequest { BucketName = "SampleBucket", Key = "Item1" }; // Issue request and remember to dispose of the response using (GetObjectResponse response = client.GetObject(request)) { // Save object to local file response.WriteResponseStreamToFile("Item1.txt"); }
.NET Core App:
Supported in: 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5, 4.0, 3.5