AWS SDK for .NET Documentation
DeleteObject Method (request)
AmazonAmazon.S3AmazonS3DeleteObject(DeleteObjectRequest) Did this page help you?   Yes   No    Tell us about it...
Removes the specified object from Amazon S3.
Declaration Syntax
C#
Parameters
request (DeleteObjectRequest)
The DeleteObjectRequest that defines the parameters of the operation.
Return Value
Returns a DeleteObjectResponse from S3.
Remarks

The DeleteObject operation removes the specified object from Amazon S3. Once deleted, there is no method to restore or undelete an object.

If you delete an object that does not exist, Amazon S3 will return a success (not an error message).

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

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