如何使用Powershell将Azure表存储中实体的属性更新为null? [英] How to use Powershell to update property of an entity in Azure Table Storage to null?

查看:52
本文介绍了如何使用Powershell将Azure表存储中实体的属性更新为null?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我已经从表中检索了一个实体.我想将属性之一设置为null.我该怎么做?这就是我所做的:

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 

但是我得到了错误:

使用"1"参数调用"Execute"的异常:对象引用未设置为对象的实例."在C:\ Program文件\ WindowsPowerShell \ Modules \ AzureRmStorageTable \ 1.0.0.21 \ AzureRmStorageTableCoreHelper.psm1:629字符:13+ ... return($ table.CloudTable.Execute((invoke-expression"[Microsoft ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo:未指定:(:) [],MethodInvocationException+ FullyQualifiedErrorId:StorageException

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

推荐答案

我认为您需要删除该列-

I think you need to remove the column -

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

这篇关于如何使用Powershell将Azure表存储中实体的属性更新为null?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆