[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
CloudBlobClient class to be used for anonymous access.
Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)
Usage
Visual Basic |
---|
Dim baseAddress As String
Dim instance As New CloudBlobClient(baseAddress) |
Syntax
Visual Basic |
---|
Public Sub New ( _
baseAddress As String _
) |
C# |
---|
public CloudBlobClient (
string baseAddress
) |
C++ |
---|
public:
CloudBlobClient (
String^ baseAddress
) |
Parameters
- baseAddress
Type: System.String
The Blob service endpoint to use to create the client.
Example
The following code example shows a console application that uses an anonymous client to download the text content of a blob in a public container.
C# | Copy Code |
---|
using System;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
namespace StorageSample
{
class Program
{
static void Main(string[] args)
{
CreateAnonymousClient();
}
static void CreateAnonymousClient()
{
//Create service client for anonymous access to the Blob service.
CloudBlobClient publicClient = new CloudBlobClient("http://storagesample.blob.core.windows.net/");
//Get a reference to a blob in a public container.
CloudBlob publicBlob = publicClient.GetBlobReference("mypubliccontainer/publicBlob.txt");
//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
Platforms
Change History
See Also