Paged blobs from azure storage

979 views Asked by At

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

There are 1 answers

2
Jim de Vries On

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