mardi 28 avril 2015

ListObjectsResponse is truncated but NextMarker is null

I'm following the example here: http://ift.tt/1pP87is

I'm getting an endless loop over the same 1000 keys here. Why is response.NextMarker null in the first iteration (and every iteration) of the while loop if response.Truncated = true?

var client = new AmazonS3Client("accessKey", "secretKey");

var request = new ListObjectsRequest().WithBucketName(bucket).WithPrefix(prefix);

            do
            {
                ListObjectsResponse response = client.ListObjects(request);

                foreach (S3Object entry in response.S3Objects)
                {
                    Console.WriteLine("key = {0} size = {1}",
                        entry.Key, entry.Size);
                }

                if (response.IsTruncated)
                {
                    request.Marker = response.NextMarker;
                }
                else
                {
                    request = null;
                }
            } while (request != null);




Aucun commentaire:

Enregistrer un commentaire