Eksportér (0) Udskriv
Udvid alt
EN
Dette indhold er ikke tilgængeligt på dit sprog, men her er den engelske version.

CloudBlobClient Constructor (Uri, StorageCredentials)

Updated: April 24, 2011

[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 using the specified Blob service endpoint and account credentials.

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

'Brug
Dim baseUri As Uri
Dim credentials As StorageCredentials

Dim instance As New CloudBlobClient(baseUri, credentials)

public CloudBlobClient (
	Uri baseUri,
	StorageCredentials credentials
)

Parameters

baseUri

Type: System.Uri

The Blob service endpoint to use to create the client.

credentials

Type: Microsoft.WindowsAzure.StorageCredentials

The account credentials.

The following code example creates a credentialed service client and uploads text content to a blob.

static void UploadBlobFromFile(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 container, which may or may not exist.
    CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
            
    //Create a new container, if it does not exist
    container.CreateIfNotExist();

    //Get a reference to a blob, which may or may not exist.
    CloudBlob blob = container.GetBlobReference("myfile.txt");

    //Upload content to the blob, which will create the blob if it does not already exist.
    blob.UploadFile("c:\\myfile.txt");
}


Development Platforms

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

 

Vis:
© 2014 Microsoft