AWS SDK for .NET Documentation
GetObjectRequest Class
AmazonAmazon.S3.ModelGetObjectRequest Did this page help you?   Yes   No    Tell us about it...
The parameters to fetch an object from a bucket.
Declaration Syntax
C#
public class GetObjectRequest : S3Request
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
GetObjectRequest()()()()
Initializes a new instance of the GetObjectRequest class

AddHeader(String, String)
Adds the header to the collection of headers for the request.
(Inherited from S3Request.)
AddHeaders(NameValueCollection)
Adds all of the specified key/value pairs into the request headers collection.
(Inherited from S3Request.)
BucketName
The name of the bucket containing the object.

ByteRange
Returns the byte range to retrieve, if set.

ByteRangeLong
Byte range of the object to return. When this is set the request downloads the specified range of an object.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
ETagToMatch
ETag to be matched as a pre-condition for returning the object, otherwise a PreconditionFailed signal is returned.

ETagToNotMatch
ETag that should not be matched as a pre-condition for returning the object, otherwise a PreconditionFailed signal is returned.

GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the type of the current instance.
(Inherited from Object.)
InputStream
Input stream for the request; content for the request will be read from the stream.
(Inherited from S3Request.)
Key
The key of the object to be fetched.

ModifiedSinceDate
Returns the object only if it has been modified since the specified time, otherwise returns a PreconditionFailed.

ReadWriteTimeout
Overrides the default HttpWebRequest ReadWriteTimeout value.
(Inherited from S3Request.)
ResponseHeaderOverrides
A set of response headers that should be returned with the object.

ServerSideEncryptionCustomerMethod
The Server-side encryption algorithm to be used with the customer provided key.

ServerSideEncryptionCustomerProvidedKey
The base64-encoded encryption key for Amazon S3 to use to decrypt the object

Using the encryption key you provide as part of your request Amazon S3 manages both the encryption, as it writes to disks, and decryption, when you access your objects. Therefore, you don't need to maintain any data encryption code. The only thing you do is manage the encryption keys you provide.

When you retrieve an object, you must provide the same encryption key as part of your request. Amazon S3 first verifies the encryption key you provided matches, and then decrypts the object before returning the object data to you.

Important: Amazon S3 does not store the encryption key you provide.


Timeout
Overrides the default HttpWebRequest timeout value.
(Inherited from S3Request.)
ToString()()()() (Inherited from S3Request.)
UnmodifiedSinceDate
Returns the object only if it has not been modified since the specified time, otherwise returns a PreconditionFailed.

VersionId
Version of the object to fetch. If not set, the latest version of the object is returned.

WithBucketName(String) Obsolete.
Sets the name of the bucket containing the object.

WithByteRange(Int32, Int32) Obsolete.
Sets a byte range of the object to return. When this is set the request downloads the specified range of an object.

WithByteRangeLong(Int64, Int64) Obsolete.
Sets a byte range of the object to return. When this is set the request downloads the specified range of an object.

WithETagToMatch(String) Obsolete.
Sets an ETag to be matched as a pre-condition for returning the object, otherwise a PreconditionFailed signal is returned.

WithETagToNotMatch(String) Obsolete.
Sets an ETag that should not be matched as a pre-condition for returning the object, otherwise a PreconditionFailed signal is returned.

WithInputStream(Stream) Obsolete.
Sets an input stream for the request; content for the request will be read from the stream.
(Inherited from S3Request.)
WithKey(String) Obsolete.
Sets the key of the object to be fetched.

WithModifiedSinceDate(DateTime) Obsolete.
Returns the object only if it has been modified since the specified time, otherwise returns a PreconditionFailed.

WithReadWriteTimeout(Int32) Obsolete.
Overrides the default HttpWebRequest ReadWriteTimeout value.

WithResponseHeaderOverrides(ResponseHeaderOverrides) Obsolete.
A set of response headers that should be returned with the object.

WithTimeout(Int32) Obsolete.
Overrides the default HttpWebRequest timeout value.

WithUnmodifiedSinceDate(DateTime) Obsolete.
Returns the object only if it has been modified since the specified time, otherwise returns a PreconditionFailed.

WithVersionId(String) Obsolete.
Sets the version of the object to fetch. If not set, the latest version of the object is returned.

Remarks
For more information about the optional parameters, refer to: http://docs.amazonwebservices.com/AmazonS3/latest/RESTObjectGET.html
Required Parameters: BucketName, Key
Optional Parameters: VersionId, ModifiedSinceDate, UnmodifiedSinceDate, ETagToMatch, ETagToNotMatch, ByteRange
Examples

This example shows how to get an object.

CopyGetObject sample
// 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);
    }
}
Inheritance Hierarchy
Object
S3Request
 GetObjectRequest

Assembly: AWSSDK (Module: AWSSDK) Version: 1.5.60.0 (1.5.60.0)