You can call the ListTable operation to query the names of all tables that are created in the current instance.
Prerequisites
- A Tablestore client is initialized. For more information, see Initialization.
- A data table is created.
API operations
/// <summary>
/// Query the names of all tables created in the current instance.
/// </summary>
/// <param name="request">Request parameter</param>
/// <returns>The table name list returned by the ListTable operation.</returns> </returns>
public ListTableResponse ListTable(ListTableRequest request);
/// <summary>
/// Asynchronous mode of ListTable.
/// </summary>
public Task<ListTableResponse> ListTableAsync(ListTableRequest request);
Examples
The following code provides an example on how to query the names of all tables in an instance:
var request = new ListTableRequest();
try
{
var response = otsClient.ListTable(request);
foreach (var tableName in response.TableNames)
{
Console.WriteLine("Table name:{0}", tableName);
}
Console.WriteLine("List table succeeded.");
}
catch (Exception ex)
{
Console.WriteLine("List table failed, exception:{0}", ex.Message);
}