How to create an empty text file ( or text with some message )inside my blob container
var destBlob = blobClient.GetBlobReference(myblob);
something like https://myxyzstorage.blob.core.windows.net/mycontainer/newfolder/newTextfile.txt
How to create an empty text file ( or text with some message )inside my blob container
var destBlob = blobClient.GetBlobReference(myblob);
something like https://myxyzstorage.blob.core.windows.net/mycontainer/newfolder/newTextfile.txt
If you are using a newer version of Windows Azure Storage Client Library, you should create a container and then use it to get a blob reference with the path you’d like your blob to have within the container. To create a path similar to the one you posted:
CloudBlobContainer container = blobClient.GetContainerReference(“mycontainer”);
container.CreateIfNotExists();
CloudBlockBlob blob = container.GetBlockBlobReference("newfolder/newTextfile.txt");
blob.UploadText("any_content_you_want");
If you are using .NET standard, this code should work.
CloudBlockBlob blob = blobContainer.GetBlockBlobReference("File Name");
blob.UploadTextAsync("<<File Content here>>");
The following example from here helped me to solve this
public Uri UploadBlob(string path, string fileName, string content)
{
var cloudBlobContainer = cloudBlobClient.GetContainerReference(path);
cloudBlobContainer.CreateIfNotExist();
var blob = cloudBlobContainer.GetBlobReference(fileName);
blob.UploadText(content);
return blob.Uri;
}