CloudTableClient.ListTablesSegmented Method ()

Storage Client Library NET API

[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 result segment containing a collection of table names in the storage account.

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

Usage

Visual Basic
Dim instance As CloudTableClient
Dim returnValue As ResultSegment(Of String)

returnValue = instance.ListTablesSegmented

Syntax

Visual Basic
Public Function ListTablesSegmented As ResultSegment(Of String)
C#
public ResultSegment<string> ListTablesSegmented ()
C++
public:
ResultSegment<String^>^ ListTablesSegmented ()
J#
JScript

Return Value

Type: Microsoft.WindowsAzure.StorageClient.ResultSegment

A result segment containing table names.

Example

The following code example lists tables in segments.

 Copy Code
public static void ListTablesInSegments(CloudStorageAccount storageAccount)
{
    // Create service client for credentialed access to the Table service.
    CloudTableClient tableClient = new CloudTableClient(storageAccount.TableEndpoint.ToString(),
        storageAccount.Credentials);

    //Return a result segment of table names.
    ResultSegment<String> resultSegment = tableClient.ListTablesSegmented();

    //Print table names to the console.
    WriteTableNames(resultSegment);

    //Check HasMoreResults to determine whether the page is complete.
    if (resultSegment.HasMoreResults)
    {
        resultSegment.GetNext();

        //Print table names to the console.
        WriteTableNames(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 table names to the console.
        WriteTableNames(resultSegment);
    }
}
        
public static void WriteTableNames(ResultSegment<string> resultSegment)
{
    foreach (string tableName in resultSegment.Results)
    {
        Console.WriteLine(tableName);
    }
}

Remarks

The ListTablesSegmented method lists table names in pages. A page is set of results of a specified size; it is represented by the ResultSegment class.This overload of the ListTablesSegmented returns results up to the per-operation limit of 1000 results.

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.

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


Thread Safety

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

Platforms

Development Platforms

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

Change History

See Also