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

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"
1
$homeItem = Get-Item -Path "/sitecore/content/Home"
$homeItem."__Display Name" = "Sitecore Home"

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • I didnt get any error but unable to find updated display name in an item – sindu Jan 25 at 18:41
  • @sindu the display name field is found in the standard fields of the item – Hishaam Namooya Jan 26 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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