title: Get list of objects from S3 bucket using Minio in .Net
body: <p>I'm using Minio .Net SDK (v 3.1.13) in a web app to get buckets and files storage at IONOS Cloud Storage. It uses the AWS S3 specifications.
  I can check is a bucket exists and its contents, but just only the first time after compilation. Next times i get empty results.</p>
  <p>S3ObjectStorage.cs</p>
  <pre><code>{
      private MinioClient _minioClient;
      public S3ObjectStorage(string key, string secret, string region, string httpsEndPoint) {
          _minioClient = new MinioClient(httpsEndPoint, key, secret, region).WithSSL();
      }
      public async Task&lt;bool&gt; BucketExists(string bucketName) {
              bool found = await _minioClient.BucketExistsAsync(bucketName);
              return found;
      }
  
      public async Task&lt;string&gt; ListFiles(string bucketName, string path)
      {
          if (!await BucketExists(bucketName)) throw new Exception($&quot;Buckect {bucketName} doesn't exists&quot;);
          List&lt;object&gt; files = new List&lt;object&gt;();
          IObservable&lt;Item&gt; observable = _minioClient.ListObjectsAsync(bucketName, path);
          IDisposable subscription = observable.Subscribe(
              item =&gt; files.Add(new { item.Key, item.Size })
              //,ex =&gt; //Console.WriteLine($&quot;OnError: {ex}&quot;)
          );
          return Newtonsoft.Json.JsonConvert.SerializeObject(files);
      }
  }```
  
  TestS3.aspx.vb
  ```Private Async Function List(bucketName As String, path As String) As Task
          Dim cs As New S3ObjectStorage(CS_KEY, CS_SECRET, CS_REGION, HTTPS_ENDPOINT)
          Dim result As String = Await cs.ListFiles(bucketName, path)
          Dim objects = Newtonsoft.Json.JsonConvert.DeserializeObject(result)
          Me.rptObjetos.DataSource = objects
          Me.rptObjetos.DataBind()
          Me.lblPath.Text = $&quot;{bucketName}&gt;&gt;{path} ({objects.Count} - {result})&quot;
      End Function```
  
  Thanks a lot.
  </code></pre>