[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
Visual Basic |
---|
Dim blobAbsoluteUri As String
Dim snapshotTime As Nullable(Of DateTime)
Dim credentials As StorageCredentials
Dim instance As New CloudBlob(blobAbsoluteUri, snapshotTime, credentials) |
Syntax
Visual Basic |
---|
Public Sub New ( _
blobAbsoluteUri As String, _
snapshotTime As Nullable(Of DateTime), _
credentials As StorageCredentials _
) |
C# |
---|
public CloudBlob (
string blobAbsoluteUri,
Nullable<DateTime> snapshotTime,
StorageCredentials credentials
) |
C++ |
---|
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.
Example
The following code example creates a new blob snapshot using a relative URI, a timestamp of an existing snapshot, and storage credentials.
C# | Copy Code |
---|
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);
}
|
Platforms
Change History
See Also