2010-11-11 4 views

Répondre

15

Il est assez facile:

string text = CloudStorageAccount.Parse("<your connection string>").CreateCloudBlobClient().GetBlobReference("path/to/the/blob.txt").DownloadText(); 

Bien sûr, si le blob est dans un récipient public, vous pouvez juste faire:

string text = new WebClient().DownloadString("http://youraccount.blob.core.windows.net/path/to/blob.txt"); 
+0

Je n'ai pas accès à 'GetBlobReference ("String") 'à la place j'ai' GetBlobReferenceFromServer() 'est-ce que j'oublie quelque chose? – jdave

+0

Cette réponse est de 2010. Je ne serais pas surpris si les noms des méthodes ont changé dans les années intermédiaires. – smarx

2
// connect to development storage. To connect to azure storage use connection string 
CloudStorageAccount storageAccount = CloudStorageAccount.DevelopmentStorageAccount; 
CloudBlobClient client = storageAccount.CreateCloudBlobClient(); 

// if you know the blob you want to access you can do this: 
CloudBlob blob = client.GetBlobReference("containername/blobname.txt"); 

// To display text in console: 
Console.WriteLine(blob.DownloadText()); 
Console.ReadKey(); 
Questions connexes