コード例 #1
0
        public void QueryTables()
        {
            string storageUri        = StorageUri;
            string accountName       = StorageAccountName;
            string storageAccountKey = PrimaryStorageAccountKey;
            string tableName         = "OfficeSupplies3p1";

            var serviceClient = new TableServiceClient(
                new Uri(storageUri),
                new TableSharedKeyCredential(accountName, storageAccountKey));

            serviceClient.CreateTable(tableName);

            #region Snippet:TablesSample3QueryTables
            // Use the <see cref="TableServiceClient"> to query the service. Passing in OData filter strings is optional.

            Pageable <TableItem> queryTableResults = serviceClient.GetTables(filter: $"TableName eq '{tableName}'");

            Console.WriteLine("The following are the names of the tables in the query results:");

            // Iterate the <see cref="Pageable"> in order to access queried tables.

            foreach (TableItem table in queryTableResults)
            {
                Console.WriteLine(table.Name);
            }
            #endregion

            serviceClient.DeleteTable(tableName);
        }