【问题标题】:Sitecore Powershell Workflow State NameSitecore Powershell 工作流状态名称
【发布时间】:2017-03-28 13:41:13
【问题描述】:

如何检索内容项的工作流状态名称,而不是工作流状态 ID (guid)?

Get-ChildItem -Path ("master:\content") -Recurse `
| Select-Object -First 10 -Property ItemPath, Name, "TemplateName", "Version", @{Label="Updated";Expression={$_.__Updated}}, @{Label="Workflow State"; Expression={$_._state}}, `
 @{Label="Published"; Expression={$_.__publish}}

我已经看到很多关于如何获取工作流状态 ID 的示例,但我需要特定项目的工作流状态的人类可读名称。

【问题讨论】:

    标签: powershell sitecore


    【解决方案1】:

    您需要通过传递检索到的项目 ID 来获取工作流状态名称。这是因为原始值中的工作流存储为 ID。这就是返回工作流状态 ID 的原因。

    使用以下脚本,将返回工作流状态的名称

    Get-ChildItem -Path ("master:\content") -Recurse `
    | Select-Object -First 10 -Property ItemPath, Name, "TemplateName", "Version", @{Label="Updated";Expression={$_.__Updated}}, @{Label="Workflow State"; Expression={(Get-Item master: -ID $_."__Workflow state").Name}}, `
     @{Label="Published"; Expression={$_.__publish}}
    

    请注意,我已在 Sitecore v8.2 上对此进行了测试,其中工作流状态的名称为 __Workflow state。您可能需要从您的脚本中相应地更新它,它使用的是_state

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-14
      • 1970-01-01
      • 1970-01-01
      • 2016-01-09
      • 1970-01-01
      相关资源
      最近更新 更多