public static List<S3ObjectVersion> ListVersionsHelper(AmazonS3Client client, string bucketName)
{
AutoResetEvent ars = new AutoResetEvent(false);
Exception responseException = new Exception();
List<S3ObjectVersion> s3ObjectVersions = null;
client.ListVersionsAsync(new ListVersionsRequest()
{
BucketName = bucketName
}, (response) =>
{
responseException = response.Exception;
if (responseException == null)
{
s3ObjectVersions = response.Response.Versions;
}
ars.Set();
}, new AsyncOptions { ExecuteCallbackOnMainThread = false });
ars.WaitOne();
if (responseException != null)
{
throw responseException;
}
return s3ObjectVersions;
}