In Sitecore Powershell for Sitecore 7.2...
Is it possible to set the "Publishable" rights on given items (to make them unpublishable)?
Specifically, I wish to automate the process of: selecting an item, opening Publish > Restrictions > Change
, clicking the Item tab, and unchecking the "Publishable" box.
I've tried find that property of an item with no luck. I thought this might work, but "__Publishable" is not correct:
(get-item -Path master:/sitecore/content/Path/Home/About-Us)."__Publishable"
Is there a way to make Powershell report ALL of the properties of an item?
The field for making an item un-publishable is:
__Never publish
So you could do this:
(get-item -Path master:/sitecore/content/DIAGlobal/Home/About-Us)."__Never publish"
Or if you wanted to edit it similar to back end code you could do:
$item = Get-Item master:/sitecore/content/DIAGlobal/Home/About-Us
$item.Editing.BeginEdit()
$item["__Never publish"] = "1"
$item.Editing.EndEdit()
Some good examples of how to read and edit fields with Powershell can be found here: http://blog.najmanowicz.com/2014/10/12/working-with-sitecore-items-in-powershell-extensions/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With