0

I need to update "Allowed Controls" field of placeholder using Sitecore Powershell. I have used below code -

$contentPlaceholder = Get-Item -Path "master:/sitecore/layout/Placeholder Settings/main"
$contentPlaceholder.Editing.BeginEdit()
$contentPlaceholder.Fields["Allowed Controls"].Value = "{ECACE287-B06E-4530-A4F6-B7FC34AA0FB0}"
$contentPlaceholder.Editing.BeginEdit()

But it is not working. Please suggest a solution.

  • 1
    I'm voting to close this question as off-topic because OP not shared what he has done so far. – Abhay Dhar Oct 24 '19 at 10:45
0

I think the only thing you are missing here is Editing.EndEdit(), I think its a typo in your code -

$contentPlaceholder = Get-Item -Path "master:/sitecore/layout/Placeholder Settings/main"
$contentPlaceholder.Editing.BeginEdit()
$contentPlaceholder.Fields["Allowed Controls"].Value = "{ECACE287-B06E-4530-A4F6-B7FC34AA0FB0}"
$contentPlaceholder.Editing.EndEdit()

This is will resolve your problem.

  • My bad! it was just a typo! – NewbieHere Oct 23 '19 at 12:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.