I have an Azure Table Storage that contains some data. I need to update one single property for all records in the table. I know the partition key and rowkey for each item. However might be so that I have new items in my CSV file.
What I need to do is:
- if an item is found in the table storage based on ParitionKey and RowKey I want to update one single property: Name.
- if an item is not found in the table it must be inserted but I have more properties that need to be filled: Name, Email, Address
I am trying to use InsertOrMerge but I got an Etag exception and how can I set up more properties if the item is not found and an insert will be required?
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
CloudTableClient cloudTableClient = storageAccount.CreateCloudTableClient();
CloudTable ct = cloudTableClient.GetTableReference("mytable");
var item = new Item()
{
PartitionKey = "PARTITIONID",
RowKey = "ROWID",
Name = "DEMO",
};
TableOperation to = TableOperation.Merge(code);
var result = await ct.ExecuteAsync(to);