CloudBlob Constructor (CloudBlob)

Storage Client Library NET API

[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 based on an existing instance.

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

Usage

Visual Basic
Dim cloudBlob As CloudBlob

Dim instance As New CloudBlob(cloudBlob)

Syntax

Visual Basic
Public Sub New ( _
	cloudBlob As CloudBlob _
)
C#
public CloudBlob (
	CloudBlob cloudBlob
)
C++
public:
CloudBlob (
	CloudBlob^ cloudBlob
)
J#
JScript

Parameters

cloudBlob

Type: Microsoft.WindowsAzure.StorageClient.CloudBlob

An existing reference to a blob.

Example

The following code example creates a reference to an anonymously-accessible blob from another reference to the same blob.

C# Copy Code
static void AccessPublicBlob2(String blobEndpoint)
{
  // Create a reference to the blob with the specified absolute URI.
  // For example:
  // "http://storagesample.blob.core.windows.net/myContainer/myBlob.txt"
  CloudBlob publicBlob = new CloudBlob(blobEndpoint);

  // Create another reference to the same blob.
  CloudBlob publicBlob2 = new CloudBlob(publicBlob);
    
  // Attempt to download the blob's contents using the second reference.
  try
  {
      Console.WriteLine(publicBlob2.DownloadText());
  }
  catch (StorageClientException e)
  {
      Console.WriteLine("Error code: ", e.ErrorCode);
      Console.WriteLine("Error message: ", e.Message);
  }
}

Platforms

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Change History

See Also