SALES: 1-800-867-1380

CloudBlob Constructor (String, Nullable, StorageCredentials)

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 an absolute 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 blobAbsoluteUri As String
Dim snapshotTime As Nullable(Of DateTime)
Dim credentials As StorageCredentials

Dim instance As New CloudBlob(blobAbsoluteUri, snapshotTime, credentials)

public CloudBlob (
	string blobAbsoluteUri,
	Nullable<DateTime> snapshotTime,
	StorageCredentials credentials
)

Parameters

blobAbsoluteUri

Type: System.String

The absolute URI to the blob.

snapshotTime

Type: System.Nullable

The snapshot timestamp, if the blob is a snapshot.

credentials

Type: Microsoft.WindowsAzure.StorageCredentials

The account credentials.

The following code example creates a new blob snapshot using a relative URI, a timestamp of an existing snapshot, and storage credentials.

static void CreateBlobSnapshot2(Uri blobEndpoint, string accountName, string accountKey)
{
    // Use the account name and key to create storage credentials.
    StorageCredentialsAccountAndKey storageCredentials = new StorageCredentialsAccountAndKey(accountName, accountKey);

    // Create a service client for credentialed access to the Blob service.
    CloudBlobClient blobClient = new CloudBlobClient(blobEndpoint, storageCredentials);

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

    // Create 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, storageCredentials);

    // 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

 

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