匯出 (0) 列印
全部展開
本主題尚未接受評分 - 為這個主題評分

CloudBlobClient.ListContainersSegmented 方法 (String, ContainerListingDetails, Int32, ResultContinuation)

Returns a result segment containing a collection of containers whose names begin with the specified prefix.

命名空間: Microsoft.WindowsAzure.StorageClient
組件: Microsoft.WindowsAzure.StorageClient (在 microsoft.windowsazure.storageclient.dll 中)
'用途
Dim instance As CloudBlobClient
Dim prefix As String
Dim detailsIncluded As ContainerListingDetails
Dim maxResults As Integer
Dim continuationToken As ResultContinuation
Dim returnValue As ResultSegment(Of CloudBlobContainer)

returnValue = instance.ListContainersSegmented(prefix, detailsIncluded, maxResults, continuationToken)
public ResultSegment<CloudBlobContainer> ListContainersSegmented (
	string prefix,
	ContainerListingDetails detailsIncluded,
	int maxResults,
	ResultContinuation continuationToken
)
public ResultSegment<CloudBlobContainer> ListContainersSegmented (
	String prefix, 
	ContainerListingDetails detailsIncluded, 
	int maxResults, 
	ResultContinuation continuationToken
)
public function ListContainersSegmented (
	prefix : String, 
	detailsIncluded : ContainerListingDetails, 
	maxResults : int, 
	continuationToken : ResultContinuation
) : ResultSegment<CloudBlobContainer>

參數

prefix

The container name prefix.

detailsIncluded

A value that indicates whether to return container metadata with the listing.

maxResults

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

continuationToken

A continuation token returned by a previous listing operation.

傳回值

A result segment of containers.

The following code example lists containers beginning with the specified prefix, in pages of 10.

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

    //Return the first segment of 10 containers in the account.
    ResultSegment<CloudBlobContainer> resultSegment = blobClient.ListContainersSegmented("my", ContainerListingDetails.None, 10, null);

    //Print container names to the console.
    WriteContainersInResultSegment(resultSegment);

    //Check HasMoreResults to determine whether the page is complete.
    if (resultSegment.HasMoreResults)
    {
        //Get the rest of the results in the page.
        resultSegment = resultSegment.GetNext();

        //Print container names to the console.
        WriteContainersInResultSegment(resultSegment);
    }

    //After the page is complete, check the continuation token to determine whether there are more 
    //results on the server.
    while (resultSegment.ContinuationToken != null)
    {
        resultSegment = resultSegment.GetNext();

        //Print container names to the console.
        WriteContainersInResultSegment(resultSegment);
    }
    }

static void WriteContainersInResultSegment(ResultSegment<CloudBlobContainer> resultSegment)
{
    foreach (var container in resultSegment.Results)
    {
        Console.WriteLine(container.Name);
    }
}

The ListContainersSegmented method begins an operation to list containers in pages. A page is set of results of a specified size; it is represented by the ResultSegment class. By returning containers in pages, you can control the number of containers returned per operation. This may be useful if, for example, you are displaying a web page with some predefined number of containers on it.

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. If HasMoreResults is true, the complete page has not been returned for some reason. Call GetNext to return the remaining results in the page.

Note that if you have not specified a page size, HasMoreResults will always be false.

Check the value of the ContinuationToken property to determine whether there are more results to return from the service after the page is complete. The continuation token is non-null as long as there are more results to return from the service. If the page is complete, then HasMoreResults will be false, but if the continuation token is non-null, there are additional results to return beyond that page.

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


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

開發平台

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

目標平台

本文對您有任何幫助嗎?
(剩餘 1500 個字元)
感謝您提供意見

社群新增項目

顯示:
© 2014 Microsoft. 著作權所有,並保留一切權利。