SALES: 1-800-867-1380

CloudBlob Constructor (String, Nullable, 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, and the snapshot timestamp, if the blob is a snapshot.

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

'Usage
Dim blobUri As String
Dim snapshotTime As Nullable(Of DateTime)
Dim serviceClient As CloudBlobClient

Dim instance As New CloudBlob(blobUri, snapshotTime, serviceClient)

public CloudBlob (
	string blobUri,
	Nullable<DateTime> snapshotTime,
	CloudBlobClient serviceClient
)

Parameters

blobUri

Type: System.String

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

snapshotTime

Type: System.Nullable

The snapshot timestamp, if the blob is a snapshot.

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 snapshot using a relative URI, a timestamp of an existing snapshot, and a reference to an existing blob client.

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

    // Get a reference to a blob.
    CloudBlob blob = blobClient.GetBlobReference("mycontainer/myblob.txt");

    // Take a snapshot of the blob.
    CloudBlob snapshot = blob.CreateSnapshot();

    // Get the snapshot timestamp.
    DateTime timestamp = (DateTime)snapshot.Attributes.Snapshot;

    // Use the timestamp to get a second reference to the snapshot.
    CloudBlob snapshot2 = new CloudBlob("mycontainer/myblob.txt", timestamp, blobClient);

    // Write out the snapshot URI.
    Console.WriteLine(snapshot2.Uri);
}

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft