Aws.AzureTools.BlobHelper.ListBlobs C# (CSharp) Method

ListBlobs() public method

public ListBlobs ( string containerName ) : IEnumerable
containerName string
return IEnumerable
        public IEnumerable<IListBlobItem> ListBlobs(string containerName)
        {
            CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference(containerName);

            return cloudBlobContainer.ListBlobs();
        }

Usage Example

Esempio n. 1
0
        static int Main(string[] args)
        {
            string containerName = Settings.Container();

            if (args.Length == 1)
            {
                containerName = args[0];

                BlobHelper blobHelper = new BlobHelper();
                foreach (IListBlobItem blob in blobHelper.ListBlobs(containerName))
                {
                    CloudBlob cloudBlob = blob as CloudBlob;

                    if (cloudBlob != null)
                    {
                        Console.WriteLine(String.Format("{0} {1}", BlobHelper.Display(blob.Uri), cloudBlob.Properties.LastModifiedUtc));
                    }
                    else
                    {
                        Console.WriteLine(BlobHelper.Display(blob.Uri));
                    }
                }
            }

            else
            {
                BlobHelper blobHelper = new BlobHelper();
                foreach (CloudBlobContainer container in blobHelper.ListContainers())
                {
                    foreach (IListBlobItem blob in container.ListBlobs())
                    {
                        CloudBlob cloudBlob = blob as CloudBlob;

                        if (cloudBlob != null)
                        {
                            Console.WriteLine(String.Format("{0} {1}", BlobHelper.Display(blob.Uri), cloudBlob.Properties.LastModifiedUtc));
                        }
                        else
                        {
                            Console.WriteLine(BlobHelper.Display(blob.Uri));
                        }
                    }
                }
            }

            return (Settings.SUCCESS);
        }