Windows Azure: Cloud Blob Client Class

Posted: January 18, 2013 in Uncategorized

Now I have previously showed you how to work on Windows Azure using Blob Storage, and went through the Windows Azure Cloud Blob Container Class, let me go through the Cloud Blob Client Class

void testingcloudblobclientclass()

{

//creating the account using the connection string

//creating the blob client

CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting(“ConnectionString”);

CloudBlobClient client = account.CreateCloudBlobClient();

 

//creating the directory, a subdirectory and a uploading a text in a blob

client.GetBlobDirectoryReference(“myblobdirectoryname”)

.GetSubdirectory(“thesubdirectoryname”)

.GetBlobReference(“newblobname”)

.UploadText(“uploading a text into a subdirectory in windows azure blob storage”);

 

//getting all the containers details from its list

foreach (CloudBlobContainer y in client.ListContainers())

{

y.FetchAttributes();

string containername = y.Name;

NameValueCollection containermetadata = y.Metadata;

BlobContainerProperties property = y.Properties;

}

 

//getting the details of the blobs in the list starting by a specified prefix

foreach(CloudBlob h in client.ListBlobsWithPrefix(“test”))

{

h.FetchAttributes();

string blobname = h.Name;

BlobProperties p = h.Properties;

}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s