[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
Visual Basic |
---|
Dim blobUri As String
Dim snapshotTime As Nullable(Of DateTime)
Dim serviceClient As CloudBlobClient
Dim instance As New CloudBlob(blobUri, snapshotTime, serviceClient) |
Syntax
Visual Basic |
---|
Public Sub New ( _
blobUri As String, _
snapshotTime As Nullable(Of DateTime), _
serviceClient As CloudBlobClient _
) |
C# |
---|
public CloudBlob (
string blobUri,
Nullable<DateTime> snapshotTime,
CloudBlobClient serviceClient
) |
C++ |
---|
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.
Example
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.
C# | Copy Code |
---|
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);
}
|
Platforms
Change History
See Also