none
Azure storage - ListContainers only returning single row

    Pertanyaan

  • Hello, 

    I have an Azure storage account that has approx. 30 blob containers in it.  I'm trying to get a list of all these containers in a .net 4.5 console app without much luck. 

    var lisfOfContainers = new List<string>();
    
    storageAccount = CloudStorageAccount.Parse(ae.ConnectionString);
    blobClient = storageAccount.CreateCloudBlobClient();
    IEnumerable<CloudBlobContainer> containers = blobClient.ListContainers();
    
    foreach (CloudBlobContainer c in containers)
    {
        lisfOfContainers.Add(c.Uri.Segments[2] != null ? c.Uri.Segments[2].ToString() : string.Empty);
    }
    
    return lisfOfContainers;

    Firstly the call to ListContainers only returns one result, even if I enumerate the result set in debug and secondly, the foreach bombs out on on the array element 2. 

    Does anyone have a working example of how to do this they could share? 

    Thanks


    Sabtu, 28 April 2018 14.59

Semua Balasan