Hi All,
We have installed the Azure Attachment management solution and moved over Annotations(notes) to the blob container on Azure.
There is now a requirement, wherein we need to create a console app, which will extract these pdf files from blob, zip them and ftp them over to the clients.
I can use zip archive to carry out the zip function in the code, but, I'm not sure about how to retrieve the .pdf files from the container in Azure using the console app.
I'm looking to understand how to query the blob database on Azure, retrieve the file and process it in C# code.
Can you please advise, or share a code sample , where a blob is being retrieved using the file name/GUID(not sure if the filename is the GUID on Azure).
An example of one of our files, which I see in the blob notes container is as(GUID + filename):
017ed429-5460-e711-814a-e0071b668681_01 Cash Cards 2017- $200.pdf
Any help is appreciated.
Thanks
Hi Ravi,
Thanks for the response to my query.
I've written the below logic to retrieve the .pdf files from blob:
var containerName = "notes";
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Microsoft.Azure.CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference(containerName);
string _blobfilename = (blobnote.Attributes["annotationid"].ToString() + "_" + blobnote.Attributes["filename"].ToString());
CloudBlockBlob blockBlob = container.GetBlockBlobReference(_blobfilename);
The issue is I need to return the blockBlob back as Entity. Do you know how that can be achieved ?
Thanks !!
Hi,
Try this blog: community.dynamics.com/.../upload-and-download-files-in-azure-blob-using-c
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156