DeleteObjectsResponse Class

.NET Framework 4.5
 
 
 
Did this page help you?  Yes  No   Tell us about it...
Returns information about the DeleteObjects response and response metadata.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceResponse
    Amazon.S3.Model.DeleteObjectsResponse

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

Syntax

C#
public class DeleteObjectsResponse : AmazonWebServiceResponse

The DeleteObjectsResponse type exposes the following members

Constructors

  Name Description
Public Method DeleteObjectsResponse()

Properties

  Name Description
Public Property ContentLength Returns the content length of the HTTP response.
Public Property DeletedObjects Gets and sets the DeletedObjects property. A list of successful deletes. Set only when Quiet=false on DeleteObjectsRequest.
Public Property DeleteErrors Gets and sets the DeleteErrors property. A list of errors encountered while deleting objects.
Public Property HttpStatusCode Returns the status code of the HTTP response.
Public Property ResponseMetadata Contains additional information about the request, such as the Request Id.

Examples

This example shows how to delete multiple objects in a single request.
Note that the call may not delete all objects. In that case, an exception will be thrown. This exception will contain the list of encountered delete errors.

DeleteObjects sample


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

// Create a DeleteObject request
DeleteObjectsRequest request = new DeleteObjectsRequest
{
    BucketName = "SampleBucket",
    Objects = new List<KeyVersion>
    {
        new KeyVersion() {Key = "Item1"},
        // Versioned item
        new KeyVersion() { Key = "Item2", VersionId = "Rej8CiBxcZKVK81cLr39j27Y5FVXghDK", },
        // Item in subdirectory
        new KeyVersion() { Key = "Logs/error.txt"}
    }
};

try
{
    // Issue request
    DeleteObjectsResponse response = client.DeleteObjects(request);
}
catch (DeleteObjectsException doe)
{
    // Catch error and list error details
    DeleteObjectsResponse errorResponse = doe.Response;

    foreach (DeletedObject deletedObject in errorResponse.DeletedObjects)
    {
        Console.WriteLine("Deleted item " + deletedObject.Key);
    }
    foreach (DeleteError deleteError in errorResponse.DeleteErrors)
    {
        Console.WriteLine("Error deleting item " + deleteError.Key);
        Console.WriteLine(" Code - " + deleteError.Code);
        Console.WriteLine(" Message - " + deleteError.Message);
    }
}

                

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