 Declaration Syntax
 Declaration Syntax| C# | 
public GetObjectResponse GetObject( GetObjectRequest request )
 Parameters
 Parameters- request (GetObjectRequest)
- The GetObjectRequest that defines the parameters of the operation.
 Return Value
 Return Value Remarks
 RemarksYou must have READ access to the object.
If READ access is granted to an anonymous user, an object can be retrieved without an authorization header. Providing a version-id for the object will fetch the specific version from S3 instead of the most recent one.
            You should wrap the response you get from calling GetObject in a using clause.
            This ensures that all underlying IO resources allocated for the response
            are disposed once the response has been processed. This is one way to
            call GetObject:
             CopyC#
CopyC#using (GetObjectResponse response = s3Client.GetObject(request))
{
    ... Process the response:
    Get the Stream, get the content-length, write contents to disk, etc
}
 Examples
 ExamplesThis example shows how to get an object.
 CopyGetObject sample
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); } }
 Exceptions
 Exceptions| Exception | Condition | 
|---|---|
| ArgumentNullException | |
| WebException | |
| AmazonS3Exception |