How display a list of Azure blob of a Container in Silverlight application?
I know how to do it in regular .Net but I need it in Silverlight. I\'m able
Okay no magic here. I can use the API or (what I will do) use a WCF Service to fetch Azure blob storage and pass thru this service in my Silverlight application to get the data.
Not magic but not complicated.
There are two ways to communicate with Azure Blob Storage:
There is however no build-in library. You will have to write the HTTP requests on your own. That might be little complicated, and it will look something like this:
private void ListFiles()
{
var uri = String.Format("{0}{1}", _containerUrl, "?restype=container&comp=list&include=snapshots&include=metadata");
_webRequest = (HttpWebRequest)WebRequestCreator.ClientHttp.Create(new Uri(uri));
_webRequest.BeginGetResponse(EndListFiles, Guid.NewGuid().ToString());
}
private void EndListFiles(IAsyncResult result)
{
var doc = _webRequest.EndGetResponse(result);
var xDoc = XDocument.Load(doc.GetResponseStream());
var blobs = from blob in xDoc.Descendants("Blob")
select ConvertToUserFile(blob);
//do whatever you need here with the blobs.
}
Please note, that this supposes, that the container is public. If your container is not public, than you would have two options:
You can read more about the options here.
Hope that helps.