Return a list of all of the buckets owned by the authenticated sender of the request.
Declaration Syntax
C# |
public ListBucketsResponse ListBuckets()
Return Value
Returns a ListBucketsResponse with the response from S3.
Examples
This example shows how to list all buckets.
CopyListBuckets sample
// Create a client AmazonS3Client client = new AmazonS3Client(); // Issue call ListBucketsResponse response = client.ListBuckets(); // View response data Console.WriteLine("Buckets owner - {0}", response.Owner.DisplayName); foreach (S3Bucket bucket in response.Buckets) { Console.WriteLine("Bucket {0}, Created on {1}", bucket.BucketName, bucket.CreationDate); }
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | |
WebException | |
AmazonS3Exception |