powershell - Sitecore powershell 控制台不显示状态字段

标签 powershell sitecore sitecore7 sitecore7.2

我有一个带有字段名称 state 的 sitecore 模板。状态字段有一个下 zipper 接字段,显示来自“国家/地区”节点的国家/地区。

我正在尝试编写一个查询,以显示具有给定状态的所有类(class)。

但是当我运行下面的查询时,它显示“Sitecore.Data.Items.ItemState”。

gci -recurse | format-table state

知道为什么它不显示状态 GUID 值吗?

最佳答案

我知道这早就应该了,您可能很久以前就处理过它,但是为了将来遇到它的任何人,让我解释一下原因和方式。

State 返回 Sitecore.Data.Items.ItemState 文本的原因是 Sitecore 项目包含名为 State 的属性Item 对象。

Sitecore PowerShell Extensions 将额外的动态属性附加到公开项目字段的对象上。但是,这些不能与此处的情况的现有项目属性发生冲突。为避免冲突,SPE 将检测它并在动态属性前加上下划线。在您的情况下,可以为您提供预期结果的一个类轮是:

gci -recurse | format-table _state

或者,如果您想将该属性显示为 State 而不是 _state,您可以使用以下语法:

gci master:\content  | format-table @{Name="State"; Expression={$_._state } }

希望这仍然对某人有帮助。

关于powershell - Sitecore powershell 控制台不显示状态字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29452272/

相关文章:

c# - Sitecore - ControllerRendering 提示 Controller "not found or does not implement IController."

visual-studio-2015 - 部署失败。原因 : The TDS connector is not the correct version.

Sitecore 7 : Combine CSS from View Renderings into the Layout <head> area

Sitecore 7 ContentSearch - 按随机排序

windows - 远程批量Powershell视频适配器查询

powershell - 使用 SAS token 上传 Blob 内容

Powershell Where-Object -in 子句

regex - 删除数组中除正则表达式模式以外的所有字符

c# - Sitecore 6 中的项目为空

security - Sitecore:删除工作流程状态中的编辑选项