[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
Visual Basic |
---|
Dim blobUri As String
Dim serviceClient As CloudBlobClient
Dim instance As New CloudBlob(blobUri, serviceClient) |
Syntax
Visual Basic |
---|
Public Sub New ( _
blobUri As String, _
serviceClient As CloudBlobClient _
) |
C# |
---|
public CloudBlob (
string blobUri,
CloudBlobClient serviceClient
) |
C++ |
---|
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.
Example
The following code example creates a new blob using a relative URI to the blob and an existing blob client.
C# | Copy Code |
---|
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);
}
|
Platforms
Change History
See Also