Retrieves objects from Amazon S3.
Namespace: Amazon.S3
Assembly: AWSSDK.dll
Version: 2.0.0.3
Syntax
public virtual GetObjectResponse GetObject( GetObjectRequest request )
Parameters
- request
-
Type: Amazon.S3.Model.GetObjectRequest
Return Value
Type: Amazon.S3.Model.GetObjectResponse
The response from the GetObject service method, as returned by AmazonS3.
Type: Amazon.S3.Model.GetObjectResponse
The response from the GetObject service method, as returned by AmazonS3.
Examples
This example shows how to get an object.
GetObject 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);
}
}
Version Information
.NET Framework:
Supported in: 4.5, 4.0, 3.5