AWS SDK for .NET Documentation
DeleteObjectRequest Class
AmazonAmazon.S3.ModelDeleteObjectRequest Did this page help you?   Yes   No    Tell us about it...
The parameters to request deletion of an object in a bucket. The operation removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object.
Declaration Syntax
C#
public class DeleteObjectRequest : S3Request
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
DeleteObjectRequest()()()()
Initializes a new instance of the DeleteObjectRequest 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 to delete.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
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 identifying the object to delete.

MfaCodes
The MfaCodes Tuple associates the Serial Number and the current Token/Code displayed on the Multi-Factor Authentication device associated with your AWS Account.

ReadWriteTimeout
Overrides the default HttpWebRequest ReadWriteTimeout value.
(Inherited from S3Request.)
Timeout
Overrides the default HttpWebRequest timeout value.
(Inherited from S3Request.)
ToString()()()() (Inherited from S3Request.)
VersionId
The identifier for the specific version of the object to be deleted, if required.

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

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 identifying the object to delete.

WithMfaCodes(String, String) Obsolete.
The MfaCodes Tuple associates the Serial Number and the current Token/Code displayed on the Multi-Factor Authentication device associated with your AWS Account.

WithReadWriteTimeout(Int32) Obsolete.
Overrides the default HttpWebRequest ReadWriteTimeout value.
(Inherited from S3Request.)
WithTimeout(Int32) Obsolete.
Overrides the default HttpWebRequest timeout value.
(Inherited from S3Request.)
WithVersionId(String) Obsolete.
Sets the identifier for the specific version of the object to be deleted, if required.

Remarks

To remove a specific version, you must be the bucket owner and you must use the versionId subresource. Using this subresource permanently deletes the version.

If the object you want to delete is in a bucket where the bucket versioning configuration is MFA Delete enabled, you must include specify the MFA serial number and value in the request.

If there isn't a null version, Amazon S3 does not remove any objects.

Examples

This example shows how to delete an object.

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

// Create a DeleteObject request
DeleteObjectRequest request = new DeleteObjectRequest
{
    BucketName = "SampleBucket",
    Key = "Item1"
};

// Issue request
client.DeleteObject(request);
Inheritance Hierarchy
Object
S3Request
 DeleteObjectRequest

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