using Microsoft.WindowsAzure.Storage;
Using Microsoft.WindowsAzure.Storage.Blob;
class RunnableClassBlobStorageUpload
{
///
/// Runs the class with the specified arguments. ///
///
The specified arguments.
public static void main(Args _args)
{
System.Byte[] reportBytes = new System.Byte[0]();
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
reportBytes = enc.GetBytes("YOUR XML STRING/TEXT");
System.IO.MemoryStream stream = new System.IO.MemoryStream(reportBytes);
CloudBlobDirectory cloudBlobDirectory;
CloudBlobClient cloudBlobClient;
CloudBlobContainer cloudBlobContainer;
CloudStorageAccount cloudStorageAccount;
cloudStorageAccount = CloudStorageAccount::Parse("DefaultEndpointsProtocol=https;AccountName=blobstorageazureservice;AccountKey=Q3zap5G1iU2GRyDQAmRF4z4hDMpPeJtj3AGfeOraiyPqFgzYrH3h59JIgFGSJX6sqTn/nbszsJHvrNz7KwfZKA==;EndpointSuffix=core.windows.net");
cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
cloudBlobContainer = cloudBlobClient.GetContainerReference("files");
CloudBlockBlob CloudBlockBlob = cloudBlobContainer.GetBlockBlobReference("Txt.Txt");
CloudBlockBlob.UploadFromStream(stream, null, null, null);
}
}
No comments:
Post a Comment