Created
January 31, 2019 03:33
-
-
Save donma/69f314eb9efd8d75b0ff6f73a38a5189 to your computer and use it in GitHub Desktop.
Azure Blob Storage Create File in root
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var connsctionString = "your_connection_string"; | |
var cloudStorage = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(connsctionString); | |
var cloudBlobClient = cloudStorage.CreateCloudBlobClient(); | |
var cloudBlobContainer = cloudBlobClient.GetContainerReference("donmablogsample"); | |
//建立如果不存在的話 | |
var result = cloudBlobContainer.CreateIfNotExistsAsync().Result; | |
//Create File | |
var bFileInfo = cloudBlobContainer.GetBlockBlobReference("sampleText.json"); | |
bFileInfo.UploadTextAsync("{\"data\":\"測試資料\"}").GetAwaiter().GetResult(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment