0

I have the following situation: An existing list has been extended with several columns, all of the type Readonly Field from other List. The Problem is, that the new columns do not show the values. If I open the item in edit mode and save it without changing anything, the values are shown for this item.

Since there are several hundred items in the list, I don't want to edit every single one. I tried to write a PowerShell script which iterates through all items and calls $item.SystemUpdate($false), but that does not help.

Do you have any suggestions how I could get the values shown for all items?

Full script:

$web = Get-SPWeb $URL
$list = $web.Lists["listName"]
$view = $list.Views["viewName"]
$items = $list.GetItems($view)

foreach($item in $items)
{
   $item.SystemUpdate($false)
}
0

To solve my Problem, I had to get the value of the columns that must be shown from the referenced list and set them in the main list.

$web = Get-SPWeb $URL
$list = $web.Lists["listName"]
$view = $list.Views["viewName"]
$items = $list.GetItems($view)
$referencedList = $web["referencedListName"]

foreach($item in $items)
{
   # get the id of the referenced item ($refId)
   $ref = $referencedList.GetItemById($refId)

   $refValue = $ref["referencedColumnName"]
   $item["columnName"] = $refValue

   $item.SystemUpdate($false)
}

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.