Radim Pluskal
Radim Pluskal

Reputation: 111

How to connect to Azure Storage Table with C#

I would like connect to existing Azure Storage Table and read (filtered) data from it. I found some examples, but everyone used deprecated WindowsAzure.Storage namespace. I can not found any solution for Azure.Storage.Common or some else from current Microsoft namespaces. There is many examples for Azure.Storage.Blobs, but i need solution for Table Storage service. Thanks much ...

Upvotes: 2

Views: 9910

Answers (2)

Manolis
Manolis

Reputation: 738

Another suggested solution is to use the Microsoft.Azure.Cosmos.Table package. As stated in the description:

When used with Azure Table Storage service, this library offers similar APIs and functionalities as WindowsAzure.Storage 8.7.0.

Its full documentation can be found here.

A code sample that helps you get a connection to a table and do actions in the below:

 private async Task<CloudTable> GetTable() {
        var storageAccount = CloudStorageAccount.Parse(StorageConnectionString);
        var tableClient = storageAccount.CreateCloudTableClient(new TableClientConfiguration());
        var table = tableClient.GetTableReference(TableName);
        await table.CreateIfNotExistsAsync();
        return table;
    }

Upvotes: 4

Jesse Squire
Jesse Squire

Reputation: 7745

The Azure.Data.Tables package is the current generation update to the Tables client library and is currently in beta. Samples can be found in the Azure SDK repository in the Tables sample area.

Upvotes: 6

Related Questions