DeleteObjectRequest Class

.NET Framework 4.5
 
 
 
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.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.S3.Model.DeleteObjectRequest

Namespace: Amazon.S3.Model
Assembly: AWSSDK.dll
Version: 2.0.0.3

Syntax

C#
public class DeleteObjectRequest : AmazonWebServiceRequest
         IRequestEvents

The DeleteObjectRequest type exposes the following members

Constructors

  Name Description
Public Method DeleteObjectRequest()

Properties

  Name Description
Public Property BucketName The name of the bucket containing the object to delete.
Public Property Key The key identifying the object to delete.
Public Property 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.
Public Property VersionId The identifier for the specific version of the object to be deleted, if required.

Examples

This example shows how to delete an object.

DeleteObject 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);

                

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.

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

.NET for Windows Store apps:
Supported in: Windows 8

.NET for Windows Phone:
Supported in: Window Phone 8