AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Returns information about the ListObjects response and response metadata.

Inheritance Hierarchy

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

Namespace: Amazon.S3.Model
Assembly: AWSSDK.S3.dll
Version: 3.x.y.z

Syntax

C#
public class ListObjectsResponse : AmazonWebServiceResponse

The ListObjectsResponse type exposes the following members

Constructors

NameDescription
Public Method ListObjectsResponse()

Properties

NameTypeDescription
Public Property CommonPrefixes System.Collections.Generic.List<System.String>

Gets the CommonPrefixes property. A response can contain CommonPrefixes only if you specify a delimiter. When you do, CommonPrefixes contains all (if there are any) keys between Prefix and the next occurrence of the string specified by delimiter. In effect, CommonPrefixes lists keys that act like subdirectories in the directory specified by Prefix. For example, if prefix is notes/ and delimiter is a slash (/), in notes/summer/july, the common prefix is notes/summer/.

Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property Delimiter System.String

Gets and sets the Delimiter property. 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.

Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property IsTruncated System.Boolean

A flag that indicates whether or not Amazon S3 returned all of the results that satisfied the search criteria.

Public Property MaxKeys System.Int32

Gets and sets the MaxKeys property. This is max number of object keys returned by the list operation.

Public Property Name System.String

The bucket name.

Public Property NextMarker System.String

Gets and sets the NextMarker property. NextMarker is set by S3 only if a Delimiter was specified in the original ListObjects request. If a delimiter was not specified, the AWS SDK for .NET returns the last Key of the List of Objects retrieved from S3 as the NextMarker.

Public Property Prefix System.String

Gets and sets the Prefix property.

Public Property RequestCharged Amazon.S3.RequestCharged

Gets and sets the property RequestCharged.

Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property S3Objects System.Collections.Generic.List<Amazon.S3.Model.S3Object>

Gets the S3Objects property. This is a list of objects in the bucket that match your search criteria.

Examples

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

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

                

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5