Skip to content

Instantly share code, notes, and snippets.

@gbellmann
Created April 13, 2015 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbellmann/99d3cf405fe857480e89 to your computer and use it in GitHub Desktop.
Save gbellmann/99d3cf405fe857480e89 to your computer and use it in GitHub Desktop.
Function to get an Azure Storage Table Entity by it's partition key and row key.
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
public object GetEntity(string partitionKey, string rowKey)
{
CloudStorageAccount account = GetAccount();
CloudTableClient cloudTableClient = account.CreateCloudTableClient();
CloudTable table = cloudTableClient.GetTableReference("YourTableName");
TableOperation retrieveOperation = TableOperation.Retrieve(partitionKey, rowKey);
TableResult retrievedResult = table.Execute(retrieveOperation);
return retrievedResult.Result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment