영업: 1-800-867-1380
EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

CloudBlobClient.GetBlobDirectoryReference Method

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.]

Returns a reference to a CloudBlobDirectory object with the specified address.

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

‘사용 방법
Dim instance As CloudBlobClient
Dim blobDirectoryAddress As String
Dim returnValue As CloudBlobDirectory

returnValue = instance.GetBlobDirectoryReference(blobDirectoryAddress)

public CloudBlobDirectory GetBlobDirectoryReference (
	string blobDirectoryAddress
)

Parameters

blobDirectoryAddress

Type: System.String

The absolute URI to the directory, or a relative URI beginning with the container name.

Return Value

Type: Microsoft.WindowsAzure.StorageClient.CloudBlobDirectory

A reference to a blob directory.

The following example gets a reference to a blob directory, then lists the blobs beneath it. The listing is carried out in two ways. In the first case, blobs are listed hierarchically. The result of the hierarchical listing contains only the blobs and blob directories that lie directly beneath the specified blob directory. A hierarchical listing is the default approach. The listing approach is determined by the value of the UseFlatBlobListing property; by default, this property is set to false.

In the second case, UseFlatBlobListing is explicitly set to true. A flat blob listing ignores the virtual hierarchy, so that all blobs beneath the blob directory are included in the listing.

static void ListBlobsInDirectory(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 blob directory in a container named 'mycontainer'.
    CloudBlobDirectory blobDir = blobClient.GetBlobDirectoryReference("mycontainer/a/b/");

    //List blobs and directories in this blob directory hierarchically.
    foreach (var blobItem in blobDir.ListBlobs())
    {
        Console.WriteLine(blobItem.Uri);
    }
    Console.WriteLine();

    //List blobs in this blob directory using a flat listing.
    BlobRequestOptions options = new BlobRequestOptions();
    options.UseFlatBlobListing = true;
    foreach (var blobItem in blobDir.ListBlobs(options))
    {
        Console.WriteLine(blobItem.Uri);
    }
}


A blob directory simplifies working with a hierarchical organization of blobs. A blob directory is a blob name prefix that can be used to navigate a hierarchy. The prefix may end in a delimiter character, but a delimiter is not required; the directory can end in any character.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

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

 

이 정보가 도움이 되었습니까?
(1500자 남음)
의견을 주셔서 감사합니다.
표시:
© 2014 Microsoft