0

I am curently trying to get a list of paged blobs from azure, but I don't really know how and I am kind of stuck. I have this method that is Pageable (it acces the blobs for a specific student, based on the id).

public Pageable<BlobItem> GetBlobsFromContainer(Guid studentId)
        {
            var containerClient = GetBlobContainerClient(studentId.ToString());
            return containerClient.GetBlobs();
        }

but I don't know how to use it in this direction. Curently it returns all the blobs existing and I am hoping for a paged result, with 6 maybe 7 blobs per page. Any thoughts?

1 Answers1

2

If you look at the documentation for the Pageable class you can see that this does not (yet) actually paginate the results but only retrieves all results for pagination.

You should use the Pageable<T>.AsPages() to return a list of pages (of type Page<T>, have look here on how to treat the result of your function

Jim de Vries
  • 156
  • 1
  • 12
  • 1
    But is there a way to get only a few blobs from azure? Something like read 10 at a time, even if there are 100? – CuriousCat11 Jul 19 '22 at 13:08
  • You could derive from the Pageable class and implement your own AsPages method that chunks the results into the size you want – Jim de Vries Jul 19 '22 at 13:19