Shiny Silverlights

...Another Silverlight MVP blog

Uncategorized

...now browsing by category

 

Files with specific extension from Azure Blob

Sunday, February 13th, 2011

There is no quick way to say to  Azure Container to only return specific file formats in a listing. You have to filter them after getting the full listing.

using System.IO; 
            IEnumerable fileList = container.ListBlobs();
            List files = new List();

            foreach (var file in fileList)
            {
                var e = Path.GetExtension(file.Uri.ToString());
                if (e.Equals(".png") || e.Equals(".jpg") || e.Equals(".jpeg"))
                {
                    files.Add(file);
                }
            }