AWS SDK for .NET Documentation
CopyObjectRequest Class
AmazonAmazon.S3.ModelCopyObjectRequest Did this page help you?   Yes   No    Tell us about it...
The parameters to request a copy an existing S3 object to another, possibly new, S3 object. The source object may be copied to another object in the same or a different bucket.
Declaration Syntax
C#
public class CopyObjectRequest : S3PutWithACLRequest
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
CopyObjectRequest()()()()
Initializes a new instance of the CopyObjectRequest 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.)
CannedACL
An S3 canned access control list to apply to the new copy of the object.

ContentType
A standard MIME type describing the format of the object data.

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

CopySourceServerSideEncryptionCustomerProvidedKey
The customer provided encryption key for the source object of the copy.

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


DestinationBucket
The name of the bucket to contain the copy of the source object.

DestinationKey
The key to be given to the copy of the source object.

Directive

Specifies whether the metadata is copied from the source object or replaced with metadata provided in the request.

Valid values: COPY | REPLACE. Default: COPY.


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 copying the source object otherwise returns a PreconditionFailed.

ETagToNotMatch
ETag that must not be matched as a pre-condition for copying the source object, otherwise returns a PreconditionFailed.

GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the type of the current instance.
(Inherited from Object.)
Grants
Gets the access control lists (ACLs) for this request. Please refer to S3Grant for information on S3 Grants.
(Inherited from S3PutWithACLRequest.)
InputStream
Input stream for the request; content for the request will be read from the stream.
(Inherited from S3Request.)
ModifiedSinceDate
Copies the object if it has been modified since the specified time, otherwise returns a PreconditionFailed.

ReadWriteTimeout
Overrides the default HttpWebRequest ReadWriteTimeout value.
(Inherited from S3Request.)
RemoveCannedACL()()()()
Resets the S3CannedACL to 'none' (S3CannedACL.NoACL).

RemoveMetaData(String)
Removes a key from the Metadata list if it was added previously

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 encrypt 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.


ServerSideEncryptionMethod

Specifies the encryption to be used on the server for the new object.

Default: None


SourceBucket
The name of the bucket containing the object to copy.

SourceKey
The key of the object to copy.

SourceVersionId
Specifies a particular version of the source object to copy. By default the latest version is copied.

StorageClass
S3 storage class for the copy of the source object. By default the new object uses the same storage class as the source object.

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

WebsiteRedirectLocation
Sets the WebsiteRedirectLocation property on the new object so that when a GET request is made from the S3 website endpoint a 301 HTTP status code will be returned indicating a redirect with the specified value as the redirect location.

WithCannedACL(S3CannedACL) Obsolete.
An S3 canned access control list to apply to the new copy of the object.

WithContentType(String) Obsolete.
Sets a standard MIME type describing the format of the object data.

WithDestinationBucket(String) Obsolete.
Sets the name of the bucket to contain the copy of the source object.

WithDestinationKey(String) Obsolete.
Sets the key to be given to the copy of the source object.

WithDirective(S3MetadataDirective) Obsolete.

Specifies whether the metadata is copied from the source object or replaced with metadata provided in the request.

Valid values: COPY | REPLACE. Default: COPY.


WithETagToMatch(String) Obsolete.
Sets an ETag to be matched as a pre-condition for copying the source object, otherwise returns a PreconditionFailed.

WithETagToNotMatch(String) Obsolete.
Sets an ETag that must not be matched as a pre-condition for copying the source object, otherwise returns a PreconditionFailed.

WithGrants(array<S3Grant>[]()[][]) Obsolete.
Adds a set of Custom Access Control Lists to be applied to the new object.

WithInputStream(Stream) Obsolete.
Sets an input stream for the request; content for the request will be read from the stream.
(Inherited from S3Request.)
WithMetaData(String, String)
Specifies a metadata name-value pair to set for the object. If MetadataDirective is set to COPY, all metadata is ignored.

WithMetaData(NameValueCollection)
Specifies a set of metadata name-value pairs to set for the object. If MetadataDirective is set to COPY, all metadata is ignored.

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

WithReadWriteTimeout(Int32) Obsolete.
Custom read-write timeout value (in milliseconds) to set in the HttpWebRequest object used for the request.

WithServerSideEncryptionMethod(ServerSideEncryptionMethod) Obsolete.

Specifies the encryption to be used on the server for the new object.

Default: None


WithSourceBucket(String) Obsolete.
Sets the name of the bucket containing the object to copy.

WithSourceKey(String) Obsolete.
Sets the key of the object to copy.

WithSourceVersionId(String) Obsolete.
Specifies a particular version of the source object to copy. By default the latest version is copied.

WithStorageClass(S3StorageClass) Obsolete.
S3 storage class for the copy of the source object. By default the new object uses the same storage class as the source object.

WithTimeout(Int32) Obsolete.
Custom timeout value (in milliseconds) to set in the HttpWebRequest object used for the request.

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

WithWebsiteRedirectLocation(String) Obsolete.
Sets the WebsiteRedirectLocation property on the new object so that when a GET request is made from the S3 website endpoint a 301 HTTP status code will be returned indicating a redirect with the specified value as the redirect location.

Examples

This example shows how to copy an object from one bucket/key to a different bucket/key.

CopyCopyObject sample
// Create a client
AmazonS3Client client = new AmazonS3Client();

// Create a CopyObject request
CopyObjectRequest request = new CopyObjectRequest
{
    SourceBucket = "SampleBucket",
    SourceKey = "Item1",
    DestinationBucket = "AnotherBucket",
    DestinationKey = "Copy1",
    CannedACL = S3CannedACL.PublicRead
};

// Issue request
client.CopyObject(request);
Inheritance Hierarchy
Object
S3Request
 S3PutWithACLRequest
  CopyObjectRequest

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