powershell - 在 Sitecore powershell 中,您能否将项目设为不可发布

标签 powershell sitecore

在适用于 Sitecore 7.2 的 Sitecore Powershell 中...

是否可以为给定项目设置“可发布”权限(使它们不可发布)?

具体来说,我希望自动化以下过程:选择一个项目,打开Publish > Restrictions > Change ,单击“项目”选项卡,然后取消选中“可发布”框。

我试过在没有运气的情况下找到一个项目的属性。我认为这可能有效,但“__Publishable”不正确:

(get-item -Path master:/sitecore/content/Path/Home/About-Us)."__Publishable"

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

最佳答案

使项目不可发布的字段是:
__Never publish
所以你可以这样做:

(get-item -Path master:/sitecore/content/DIAGlobal/Home/About-Us)."__Never publish"

或者,如果您想像后端代码一样编辑它,您可以执行以下操作:
$item = Get-Item master:/sitecore/content/DIAGlobal/Home/About-Us
$item.Editing.BeginEdit()
$item["__Never publish"] = "1"
$item.Editing.EndEdit()

可以在此处找到有关如何使用 Powershell 读取和编辑字段的一些很好的示例:http://blog.najmanowicz.com/2014/10/12/working-with-sitecore-items-in-powershell-extensions/

关于powershell - 在 Sitecore powershell 中,您能否将项目设为不可发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31950065/

相关文章:

php - 通过 PHP 使用 Exchange 管理单元执行 powershell 脚本

powershell - 在PowerShell中查找当前的当前季度以添加格式为 “yyyyqq”的文件名

perl - 在 Windows 8 PowerShell ISE 中运行 Strawberry Perl

namespaces - CertificateWebRequestHandlerModifierOptions 位于哪个命名空间?

asp.net-mvc - Azure Blob - 上传时出现 403 - Sitecore CM/CD 拓扑

powershell - 如何使用Powershell递归强制文件夹时间戳?

powershell - 如何在 Azure Function 中安装 PowerShell 模块

database - Sitecore Lucene : re-index child (or parent) items on updating item

c# - Sitecore - 在核心数据库中存储图像

c# - 使用方法与属性从使用 LINQ 的类中检索数据