CloudBlob Constructor (String)

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 using an absolute URI to the blob.

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

Usage

Visual Basic
Dim blobAbsoluteUri As String

Dim instance As New CloudBlob(blobAbsoluteUri)

Syntax

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

Parameters

blobAbsoluteUri

Type: System.String

The absolute URI to the blob.

Example

The following code example creates a reference to an anonymously-accessible blob using it’s absolute URI.

C# Copy Code
static void AccessPublicBlob(String blobEndpoint)
{
  // For example:
  // "http://storagesample.blob.core.windows.net/myContainer/myBlob.txt"
  CloudBlob publicBlob = new CloudBlob(blobEndpoint);

  // Attempt to download the blob's contents.
  try
  {
      Console.WriteLine(publicBlob.DownloadText());
  }
  catch (StorageClientException e)
  {
    Console.WriteLine("Error code: ", e.ErrorCode);
    Console.WriteLine("Error message: ", e.Message);
  }
}

Remarks

Any authentication information inside the address will be used to set the blob's credentials.

Otherwise a blob for anonymous access is created.

Any snapshot information as part of the address will indicate that this blob is a snapshot.


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