Created
August 29, 2016 14:16
-
-
Save vitormeriat/01e06c5a93c948f3aa3844f993153170 to your computer and use it in GitHub Desktop.
List Tables Azure Storage Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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