0

When I try to update the display name of the item am getting the following error. Please let me know how to fix this?

            Working
     Please wait, working... unlike you!
       'DisplayName' is a ReadOnly property.
      At C:\inetpub\wwwroot\qablog1\temp\tmp7D8B.ps1:13 char:7
+       $row.DisplayName="fff"
+       ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException

Script:

$AllDining = Get-ChildItem -Path "master://sitecore/content/root/Dining" -Recurse

foreach ( $row in $AllDining ) {
    $row.Editing.BeginEdit();
    $row.DisplayName="fff"
    $row.Editing.EndEdit();
    Write-host "title: " $row["DisplayName"];
}
Write-Log $logInfo

2 Answers 2

4

You will need to update the following line:

$row.DisplayName="fff"

and replace it with:

$row."__Display Name"="fff"

You should also probably update your Write-Host line as follows:

Write-Host "title: " $row."__Display Name"
2
$homeItem = Get-Item -Path "/sitecore/content/Home"
$homeItem."__Display Name" = "Sitecore Home"
2
  • I didnt get any error but unable to find updated display name in an item Commented Jan 25, 2019 at 18:41
  • @sindu the display name field is found in the standard fields of the item Commented Jan 26, 2019 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.