0

Below this code was not working

 Write-Host "Total Number version for this item: " $fieldName  -ForegroundColor Blue
                for ($i = 0; $i -lt $item.Versions.Count; $i++)
                {
                 if ($item.Versions[$i][$fieldName] -ne $null)
                    {
                    $item.Versions.VersionId["Document Status"] = "Superseded";
                       $item.Versions[$i].SystemUpdate();
                    }
                    }
0

No. There is no straight forward api/method for that. A complex and somewhat riskier method will be to remove newer versions modify value and then add newer versions again.

On same lines, one may create a new list to store all items and versions there, empty original list and add items with versions with changes as required.

Unless it is very very business critical, build logic to accept both "Document Status" values with some additional logic e.g. if "Modified" is less than <date of logic change> and "Document Status" is "<something>" or "Modified" is more than or equals <date of logic change> and "Document Status" is "<something>" then ...

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.