I want to pull a PDF file from a Private/Protected container in Azure. If it was a public container I could just use a Url. But, I can't do that so I believe this needs to be pulled following this type of method:
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageName);
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer sourceContainer =
blobClient.GetContainerReference(
sourceContainerName);
CloudBlockBlob sourceBlob =
sourceContainer.GetBlockBlobReference(fileName);
if
(await sourceBlob.ExistsAsync())
{
// pull the file into memory
using
(MemoryStream stream =
new
MemoryStream())
{
// load the stream from the blob
await sourceBlob.DownloadToStreamAsync(stream);
await sourceBlob.FlushAsync();
stream.Position = 0;
...
So, this turns the BLOB into a Memory Stream. Do you have a best-practices example on how I should do this? If not, do you have an example of how I can load a stream directly into the control. Better yet, I pull this through a REST service. Do you have an example on how to request a stream from an API that then loads it into the control?
Thanks for your help,
Joel