AWS SDK for .NET Documentation
PutObjectResponse Class
AmazonAmazon.S3.ModelPutObjectResponse Did this page help you?   Yes   No    Tell us about it...
The PutObjectResponse contains any headers returned by S3.
Declaration Syntax
C#
public class PutObjectResponse : S3Response
Members
All MembersConstructorsMethodsProperties



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

AmazonId2
Gets and sets the AmazonId2 property. This property corresponds to the x-amz-id-2 header in the HTTP response from the Amazon S3 service. The value of this header is used for internal troubleshooting purposes.
(Inherited from S3Response.)
Dispose()()()()
Disposes of all managed and unmanaged resources.
(Inherited from S3Response.)
Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
ETag
Gets and sets the ETag property.

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.

GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the type of the current instance.
(Inherited from Object.)
Headers
Gets and sets the Headers property.
(Overrides S3Response.Headers.)
Metadata
Gets and sets the Metadata property.
(Inherited from S3Response.)
RequestId
Gets and sets the RequestId property.
(Inherited from S3Response.)
ResponseStream
Gets and sets the ResponseStream property. This property only has a valid value for GetObjectResponses. In order to use this stream without leaking the underlying resource, please wrap access to the stream within a using block.
CopyC#
(Inherited from S3Response.)
ResponseXml
Gets and sets the ResponseXml property. This is the original xml response received from S3
(Inherited from S3Response.)
ServerSideEncryptionMethod
Gets and sets the ServerSideEncryptionMethod property. Specifies the encryption used on the server to store the content. Default is None.

StatusCode
Gets the HTTP Status code from the service response.
(Inherited from S3Response.)
ToString()()()()
String Representation of this object. Overrides Object.ToString()
(Inherited from S3Response.)
VersionId
Gets and sets the VersionId property. This is the version-id of the S3 object

Examples

This following examples show multiple ways of creating an object.

This example shows how to put an object, with its content being passed along as a string.

CopyPutObject sample 1
// Create a client
AmazonS3Client client = new AmazonS3Client();

// Create a PutObject request
PutObjectRequest request = new PutObjectRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    ContentBody = "This is sample content..."
};

// Put object
PutObjectResponse response = client.PutObject(request);

This example shows how to put an object, setting its content to be a file.

CopyPutObject sample 2
// Create a client
AmazonS3Client client = new AmazonS3Client();

// Create a PutObject request
PutObjectRequest request = new PutObjectRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
    FilePath = "contents.txt"
};

// Put object
PutObjectResponse response = client.PutObject(request);

This example shows how to put an object using a stream.

CopyPutObject sample 3
// Create a client
AmazonS3Client client = new AmazonS3Client();

// Create a PutObject request
PutObjectRequest request = new PutObjectRequest
{
    BucketName = "SampleBucket",
    Key = "Item1",
};
using (FileStream stream = new FileStream("contents.txt", FileMode.Open))
{
    request.InputStream = stream;

    // Put object
    PutObjectResponse response = client.PutObject(request);
}
Inheritance Hierarchy
Object
S3Response
 PutObjectResponse

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