Question

In SharePoint 2013 List A, I want to refresh value of column A of all items, but I don't want to make new item version when I do refreshing/update.
Column A is calculated column and it is calculating difference in time between Now() and some other date column. So it would display correct value only if user manually edit item.

I found PowerShell script that updates column A, but it will leave new item version, any chance to suggest me how can I modify it so Items won't be updated?

$web = Get-SPWeb http://Server/ListLocation
$list = $web.Lists["ListA"]

foreach ($item in $list.Items)
{
  $item.Update();
}
Était-ce utile?

La solution

Try below code:

$web = Get-SPWeb http://Server/ListLocation
$list = $web.Lists["ListA"]

foreach ($item in $list.Items)
{
  $item.UpdateOverwriteVersion();
}

Reference - UpdateOverwriteVersion

You can also use:

item.SystemUpdate();

difference -

UpdateOverwriteVersion() - updates the list item without creating a new version, but the Modified and Modified By fields are also updated.

SystemUpdate() - updates the list item without creating a new version,also the fields Modified and Modified By are not updated.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top