2010-11-11 95 views

回答

15

這是很容易:

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

當然,如果斑在一個公開的容器,你可以這樣做:

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

我沒有訪問'GetBlobReference( 「String」)'而不是'我有'GetBlobReferenceFromServer()'我忘記了什麼? – jdave 2016-04-21 16:29:11

+0

這個答案是從2010年開始的。如果方法名稱在中間年份發生了變化,我不會感到驚訝。 – smarx 2016-04-21 16:55:00

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();