AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Namespace: Amazon.S3.Model
Assembly: AWSSDK.dll
Version: (assembly version)
public class DeleteObjectRequest : AmazonWebServiceRequest IRequestEvents
The DeleteObjectRequest type exposes the following members
Name | Description | |
---|---|---|
DeleteObjectRequest() |
Name | Type | Description | |
---|---|---|---|
BucketName | System.String | The name of the bucket containing the object to delete. | |
Key | System.String | The key identifying the object to delete. | |
MfaCodes | Amazon.S3.Model.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. | |
VersionId | System.String | The identifier for the specific version of the object to be deleted, if required. |
This example shows how to delete an object.
// Create a client AmazonS3Client client = new AmazonS3Client(); // Create a DeleteObject request DeleteObjectRequest request = new DeleteObjectRequest { BucketName = "SampleBucket", Key = "Item1" }; // Issue request client.DeleteObject(request);
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.
.NET Framework:
Supported in: 4.5, 4.0, 3.5
.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8
.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8