0
votes

Lets say I have retrieved an entity from my table. I want to set one of the property to null. How can I do it? This is what I did:

 $myData.PropertyOne = $null
 $myData | Update-AzureStorageTableRow -table $destStorageTable 

But I got error:

Exception calling "Execute" with "1" argument(s): "Object reference not set to an instance of an object." At C:\Program Files\WindowsPowerShell\Modules\AzureRmStorageTable\1.0.0.21\AzureRmStorageTableCoreHelper.psm1:629 char:13 + ... return ($table.CloudTable.Execute((invoke-expression "[Microsoft ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : StorageException

2
What is the data type of PropertyOne?Gaurav Mantri
It can be string, datetime or guid. But I don't think the datatype matters?Nyamnyam
Datatype does matter. Azure Tables is schema-less key-value pair store so essentially it doesn't store null values (except for string data type I believe). Can you edit your question and share the object model.Gaurav Mantri
Do you have any update about this thread?Tom Sun - MSFT

2 Answers

0
votes

How can I do it?

The problem is that because azure table storage does not have a schema, the null column actually doesn't exist. You could do something like store an empty string if you really have to.

 $myData.PropertyOne = ""
 $myData | Update-AzureStorageTableRow -table $destStorageTable 

enter image description here

0
votes

I think you need to remove the column -

$myData.psobject.Properties.Remove('PropertyOne')
$myData | Update-AzureStorageTableRow -table $destStorageTable