Removes the specified object from Amazon S3.
![](../icons/collapse_all.gif)
C# |
public DeleteObjectResponse DeleteObject( DeleteObjectRequest request )
![](../icons/collapse_all.gif)
- request (DeleteObjectRequest)
- The DeleteObjectRequest that defines the parameters of the operation.
![](../icons/collapse_all.gif)
Returns a DeleteObjectResponse from S3.
![](../icons/collapse_all.gif)
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).
![](../icons/collapse_all.gif)
This example shows how to delete an object.
![](../icons/CopyCode.gif)
// Create a client AmazonS3Client client = new AmazonS3Client(); // Create a DeleteObject request DeleteObjectRequest request = new DeleteObjectRequest { BucketName = "SampleBucket", Key = "Item1" }; // Issue request client.DeleteObject(request);
![](../icons/collapse_all.gif)
Exception | Condition |
---|---|
ArgumentNullException | |
WebException | |
AmazonS3Exception |