CloudBlob Constructor (String, CloudBlobClient)

Updated: April 24, 2013

[This topic is part of the Microsoft Azure Storage Client Library 1.7, which has been deprecated. See Storage Client Library for the latest version.]

Initializes a new instance of the CloudBlob class using a relative URI to the blob.

Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)

'Usage
Dim blobUri As String
Dim serviceClient As CloudBlobClient

Dim instance As New CloudBlob(blobUri, serviceClient)

public CloudBlob (
	string blobUri,
	CloudBlobClient serviceClient
)

Parameters

blobUri

Type: System.String

The relative URI to the blob, beginning with the container name.

serviceClient

Type: Microsoft.WindowsAzure.StorageClient.CloudBlobClient

A client object that specifies the endpoint for the Blob service.

The following code example creates a new blob using a relative URI to the blob and an existing blob client.

static void WriteBlobMetadata3(Uri blobEndpoint, string accountName, string accountKey)
{
    // Create service client for credentialed access to the blob.
    CloudBlobClient blobClient = new CloudBlobClient(blobEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey));

    // Create a CloudBlob reference.
    CloudBlob blob = new CloudBlob("mycontainer/myblob.txt", blobClient);

    // Write text to the blob.
    blob.UploadText("This is a text blob.");

    // Define metadata for the blob.
    blob.Metadata["category"] = "images";
    blob.Metadata["owner"] = "azureix";

    // Set options for the request. E.g., Specify an operation timeout of 20 seconds.
    BlobRequestOptions options = new BlobRequestOptions();

    options.Timeout = TimeSpan.FromSeconds(20.0);

    // Write the metadata to the blob.
    blob.SetMetadata(options);
}

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

 

Reference

CloudBlob Class
CloudBlob Members
Microsoft.WindowsAzure.StorageClient Namespace

Other Resources

Naming and Referencing Containers, Blobs, and Metadata

Show: