销售电话: 1-800-867-1380

CloudBlobClient.EndListBlobsWithPrefixSegmented 方法

Ends an asynchronous operation to return a result segment containing a collection of blob items whose names begin with the specified prefix.

命名空间: Microsoft.WindowsAzure.StorageClient
程序集: Microsoft.WindowsAzure.StorageClient(在 microsoft.windowsazure.storageclient.dll 中)

用法
Dim instance As CloudBlobClient
Dim asyncResult As IAsyncResult
Dim returnValue As ResultSegment(Of IListBlobItem)

returnValue = instance.EndListBlobsWithPrefixSegmented(asyncResult)

public ResultSegment<IListBlobItem> EndListBlobsWithPrefixSegmented (
	IAsyncResult asyncResult
)
public ResultSegment<IListBlobItem> EndListBlobsWithPrefixSegmented (
	IAsyncResult asyncResult
)
public function EndListBlobsWithPrefixSegmented (
	asyncResult : IAsyncResult
) : ResultSegment<IListBlobItem>

参数

asyncResult

An IAsyncResult that references the pending asynchronous operation.

返回值

A result segment containing objects that implement IListBlobItem.

The following sample code lists blobs in a container with an asynchronous operation. The blob prefix includes the name of the container and the beginning of the blob name.

static void ListBlobsInSegmentsAsynchronously(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));

    //Begin the operation to return a page of up to 5000 blobs, passing the service client to the callback.
    blobClient.BeginListBlobsWithPrefixSegmented("lotsofblobs/0", ListBlobsInSegmentsCallback, blobClient);
}

static void ListBlobsInSegmentsCallback(IAsyncResult result)
{
    CloudBlobClient blobClient = (CloudBlobClient)result.AsyncState;

    //End the operation.
    ResultSegment<IListBlobItem> resultSegment = blobClient.EndListBlobsWithPrefixSegmented(result);

    //Enumerate the blob items.
    foreach (var blobItem in resultSegment.Results)
    {
        Console.WriteLine(blobItem.Uri);
    }

    //Check the continuation token to determine whether there are more results.
    if (resultSegment.ContinuationToken != null)
    {
        //Get the next result segment.
        resultSegment = resultSegment.GetNext();

        //Enumerate the blob items.
        foreach (var blobItem in resultSegment.Results)
        {
            Console.WriteLine(blobItem.Uri);
        }
    }
}

This method blocks until the listing operation is complete.


此类型的任何公共静态(在 Visual Basic 中为 Shared)成员都是线程安全的。但不保证所有实例成员都是线程安全的。

开发平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003、Windows Server 2008 和 Windows 2000

目标平台

本文是否对您有所帮助?
(1500 个剩余字符)
感谢您的反馈

社区附加资源

显示:
© 2014 Microsoft