如何使用Powershell将Azure表存储中的实体属性更新为null?

问题描述 投票:0回答:2

假设我从我的桌子中检索了一个实体。我想将其中一个属性设置为null。我该怎么做?这就是我做的:

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

但是我得到了错误:

使用“1”参数调用“Execute”的异常:“对象引用未设置为对象的实例。”在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

powershell azure azure-table-storage
2个回答
0
投票

我该怎么做?

问题是因为azure表存储没有架构,所以null列实际上不存在。如果你真的需要,你可以做一些像存储空字符串的事情。

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

enter image description here


0
投票

我想你需要删除列 -

$myData.psobject.Properties.Remove('PropertyOne')
$myData | Update-AzureStorageTableRow -table $destStorageTable 
© www.soinside.com 2019 - 2024. All rights reserved.