Skip to content

Instantly share code, notes, and snippets.

@vitormeriat
Created August 29, 2016 14:16
Show Gist options
  • Save vitormeriat/01e06c5a93c948f3aa3844f993153170 to your computer and use it in GitHub Desktop.
Save vitormeriat/01e06c5a93c948f3aa3844f993153170 to your computer and use it in GitHub Desktop.
List Tables Azure Storage Service
class Program
{
static void Main(string[] args)
{
Console.Title = "Listar Tabelas do Azure Storage Service";
//"DefaultEndpointsProtocol=https;AccountName=MinhaConta;AccountKey=MinhaSenha";
string connectionString = "UseDevelopmentStorage=true";
var TablesName = ListaNomesTabelas(connectionString);
int contador = 1;
foreach (var item in TablesName)
Console.WriteLine(string.Format("{0} - {1}", contador++, item.Name));
Console.WriteLine(string.Format("Foram encontradas {0} tabelas.", contador - 1));
Console.Read();
}
private static List<CloudTable> ListaNomesTabelas(string connectionString)
{
CloudStorageAccount account = CloudStorageAccount.Parse(connectionString);
Uri uriAddress = new Uri(account.TableEndpoint.ToString());
CloudTableClient tableClient = new CloudTableClient(uriAddress, account.Credentials);
List<CloudTable> result = tableClient.ListTables().ToList<CloudTable>();
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment