AWS SDK for .NET Documentation
ListObjectsRequest Class
AmazonAmazon.S3.ModelListObjectsRequest Did this page help you?   Yes   No    Tell us about it...
The parameters to list the object keys in a bucket.
Declaration Syntax
C#
public class ListObjectsRequest : S3Request
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
ListObjectsRequest()()()()
Initializes a new instance of the ListObjectsRequest class

AddHeader(String, String)
Adds the header to the collection of headers for the request.
(Inherited from S3Request.)
AddHeaders(NameValueCollection)
Adds all of the specified key/value pairs into the request headers collection.
(Inherited from S3Request.)
BucketName
The name of the bucket containing the objects whose keys are to be listed.

Delimiter
Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere in the response.

Encoding
Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key may contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the type of the current instance.
(Inherited from Object.)
InputStream
Input stream for the request; content for the request will be read from the stream.
(Inherited from S3Request.)
Marker
Indicates where in the bucket to begin listing. The list will only include keys that occur lexicographically after marker. This is convenient for pagination: to get the next page of results use the last key of the current page as the marker.

MaxKeys
The maximum number of keys you'd like to see in the response body. The server might return fewer than this many keys, but will not return more.

Prefix
Limits the response to keys which begin with the indicated prefix. You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file system uses folders.

ReadWriteTimeout
Overrides the default HttpWebRequest ReadWriteTimeout value.
(Inherited from S3Request.)
Timeout
Overrides the default HttpWebRequest timeout value.
(Inherited from S3Request.)
ToString()()()() (Inherited from S3Request.)
WithBucketName(String) Obsolete.
Sets the name of the bucket containing the objects whose keys are to be listed.

WithDelimiter(String) Obsolete.
Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere in the response.

WithEncoding(EncodingType) Obsolete.
Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key may contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response.

WithInputStream(Stream) Obsolete.
Sets an input stream for the request; content for the request will be read from the stream.
(Inherited from S3Request.)
WithMarker(String) Obsolete.
Indicates where in the bucket to begin listing. The list will only include keys that occur lexicographically after marker. This is convenient for pagination: to get the next page of results use the last key of the current page as the marker.

WithMaxKeys(Int32) Obsolete.
The maximum number of keys you'd like to see in the response body. The server might return fewer than this many keys, but will not return more.

WithPrefix(String) Obsolete.
Limits the response to keys which begin with the indicated prefix. You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file system uses folders.

WithReadWriteTimeout(Int32) Obsolete.
Overrides the default HttpWebRequest ReadWriteTimeout value.
(Inherited from S3Request.)
WithTimeout(Int32) Obsolete.
Overrides the default HttpWebRequest timeout value.
(Inherited from S3Request.)
Examples

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;
do
{
    // 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);
Inheritance Hierarchy
Object
S3Request
 ListObjectsRequest

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