AWS SDK for .NET Documentation
ListObjects Method (request)
AmazonAmazon.S3AmazonS3ListObjects(ListObjectsRequest) Did this page help you?   Yes   No    Tell us about it...
Return the set of objects/keys in the specified bucket, ordered lexicographically (from a-Z).
Declaration Syntax
request (ListObjectsRequest)
The ListObjectsRequest that defines the parameters of the operation.
Return Value
Returns a ListObjectsResponse from S3 with a list of S3Objects, headers and request parameters used to filter the list.

Since buckets can contain a virtually unlimited number of objects, the complete results of a list query can be extremely large. To manage large result sets, Amazon S3 uses pagination to split them into multiple responses. Callers should always check the IsTruncated to see if the returned listing is complete, or if callers need to make additional calls to get more results. The marker parameter allows callers to specify where to start the object listing.

List performance is not substantially affected by the total number of keys in your bucket, nor by the presence or absence of any additional query parameters. The list can be filtered via the Marker property of the ListObjectsRequest.

In order to List Objects, you must have READ access to the bucket.


This example shows how to list all objects in a bucket.

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

// List all objects
ListObjectsRequest listRequest = new ListObjectsRequest
    BucketName = "SampleBucket",

ListObjectsResponse listResponse;
    // Get a list of objects
    listResponse = client.ListObjects(listRequest);
    foreach (S3Object obj in listResponse.S3Objects)
        Console.WriteLine("Object - " + obj.Key);
        Console.WriteLine(" Size - " + obj.Size);
        Console.WriteLine(" LastModified - " + obj.LastModified);
        Console.WriteLine(" Storage class - " + obj.StorageClass);

    // Set the marker property
    listRequest.Marker = listResponse.NextMarker;
} while (listResponse.IsTruncated);

Assembly: AWSSDK (Module: AWSSDK) Version: (