在Sitecore powershell中,您可以使项目不可发布

Tim*_*ant 3 powershell sitecore

在Sitecore Powershell中为Sitecore 7.2 ...

是否可以在给定项目上设置"可发布"权限(使其不可发布)?

具体来说,我希望自动执行以下过程:选择项目,打开Publish > Restrictions > Change,单击项目选项卡,然后取消选中"可发布"框.

我试过找到没有运气的物品属性.我认为这可能有效,但"__Publishable"不正确:

(get-item -Path master:/sitecore/content/Path/Home/About-Us)."__Publishable"
Run Code Online (Sandbox Code Playgroud)

有没有办法让Powershell报告项目的所有属性?

Ric*_*eal 6

使项目不可发布的字段是:

__Never publish

所以你可以这样做:

(get-item -Path master:/sitecore/content/DIAGlobal/Home/About-Us)."__Never publish"
Run Code Online (Sandbox Code Playgroud)

或者如果你想编辑它类似于后端代码,你可以这样做:

$item = Get-Item master:/sitecore/content/DIAGlobal/Home/About-Us
$item.Editing.BeginEdit()
$item["__Never publish"] = "1"
$item.Editing.EndEdit()
Run Code Online (Sandbox Code Playgroud)

有关如何使用Powershell读取和编辑字段的一些很好的示例,请访问:http://blog.najmanowicz.com/2014/10/12/working-with-sitecore-items-in-powershell-extensions/