匯出 (0) 列印
全部展開

CloudBlobDirectory.BeginListBlobsSegmented 方法 (Int32, ResultContinuation, BlobRequestOptions, AsyncCallback, Object)

Begins an asynchronous request to return a result segment containing a collection of blob items.

命名空間: Microsoft.WindowsAzure.StorageClient
組件: Microsoft.WindowsAzure.StorageClient (在 microsoft.windowsazure.storageclient.dll 中)

'用途
Dim instance As CloudBlobDirectory
Dim maxResults As Integer
Dim continuationToken As ResultContinuation
Dim options As BlobRequestOptions
Dim callback As AsyncCallback
Dim state As Object
Dim returnValue As IAsyncResult

returnValue = instance.BeginListBlobsSegmented(maxResults, continuationToken, options, callback, state)

public IAsyncResult BeginListBlobsSegmented (
	int maxResults,
	ResultContinuation continuationToken,
	BlobRequestOptions options,
	AsyncCallback callback,
	Object state
)
public IAsyncResult BeginListBlobsSegmented (
	int maxResults, 
	ResultContinuation continuationToken, 
	BlobRequestOptions options, 
	AsyncCallback callback, 
	Object state
)
public function BeginListBlobsSegmented (
	maxResults : int, 
	continuationToken : ResultContinuation, 
	options : BlobRequestOptions, 
	callback : AsyncCallback, 
	state : Object
) : IAsyncResult

參數

maxResults

A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the per-operation limit of 5000. If this value is zero, the maximum possible number of results will be returned, up to 5000.

continuationToken

A continuation token returned by a previous listing operation.

options

An object that specifies any additional options for the request.

callback

The callback delegate that will receive notification when the asynchronous operation completes.

state

A user-defined object that will be passed to the callback delegate.

傳回值

An IAsyncResult that references the asynchronous operation.

The following code example lists the blobs in a blob directory in segments, using the default hierarchical listing.

static void ListBlobsInDirectoryAsynchronously(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.
    CloudBlobDirectory blobDir = blobClient.GetBlobDirectoryReference("myvirtualdir/a/");

    //Begin the operation to return the first segment of blobs, passing the service client to the callback.
    blobDir.BeginListBlobsSegmented(ListBlobsInDirectoryCallback, blobDir);
}

static void ListBlobsInDirectoryCallback(IAsyncResult result)
{
    CloudBlobDirectory blobDir = (CloudBlobDirectory)result.AsyncState;
    //End the operation.
    ResultSegment<IListBlobItem> resultSegment = blobDir.EndListBlobsSegmented(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, returning up to 1000 blobs per operation.
        blobDir.BeginListBlobsSegmented(1000, resultSegment.ContinuationToken, new BlobRequestOptions(), ListBlobsInSegmentsCallback, blobDir);
    }
}

The BeginListBlobsSegmented method begins an operation to list blobs in pages. To specify the page size to return, pass in a non-zero value for the maxResults parameter. Passing in zero for the maxResults parameter returns either the maximum number of results available, or the per-operation limit of 5000 results.

If you have specified a page size, you can check the HasMoreResults property to check whether the page is complete. For example, if you have specified a page size of 10,000, a value which exceeds the per-operation limit, HasMoreResults will return true, indicating that the page is not complete. Note that if you have not specified a page size, HasMoreResults will always be false.

If you have not specified a page size, or the value of maxResults is zero, then check the value of the ContinuationToken property to determine whether there are more results to return. The continuation token is non-null as long as there are more results to return from the service.

Call the GetNext method to return the next segment of results from the service.

The objects returned by the listing depend on the type of listing that is being performed. If the UseFlatBlobListing property is set to true, the listing will return an enumerable collection of CloudBlob objects. If UseFlatBlobListing is set to false (the default value), the listing may return a collection containing CloudBlob objects and CloudBlobDirectory objects. The latter case provides a convenience for subsequent enumerations over a virtual blob hierarchy.


任何這個類型的公用靜態 (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。 並非所有的執行個體成員都是安全執行緒。

開發平台

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

目標平台

社群新增項目

顯示:
© 2014 Microsoft