We have document libraries in Sharepoint 2010 with incorrect modified dates and users (they were imported from somewhere). I thought, I could correct them with Powershell, but it does not work the way I tried and I cannot figure out what is wrong.

It is easy for list items:

$item["Editor"] = $newuser
$iten["Modified"] = $newdate

I thought, I could adapt this to versions. I can read the properties, but when I try to assign a new value, it throws an error:

Unable to index into an object of type Microsoft.SharePoint.SPListItemVersion.
At line:1 char:10
+ $version[ <<<< "Modified"]=$newdate
+ CategoryInfo          : InvalidOperation: (Modified:String) [], RuntimeE
+ FullyQualifiedErrorId : CannotIndex

What am I doing wrong? Is there another way to change these values?

  • Can you share what code you used to update versions. Moreover, it should not be $item.update(). It should rather be $item.SystemUpdate() Commented Mar 11, 2015 at 13:57
  • I have not had the chance to update (yet). The error is thrown before. I cannot even assign the value.
    – EGwalden
    Commented Mar 11, 2015 at 14:23

2 Answers 2


You cannot change item version properties as SPListItemVersion.this[string] indexer is read only. That is, whereas this code is legal:

SPListItem item = list.GetItemById(1);
item["X"] = "a";

The below code will throw error:

Property or indexer 'Microsoft.SharePoint.SPListItemVersion.this[string]' cannot be assigned to -- it is read only

SPListItem item = list.GetItemById(1);                
SPListItemVersionCollection versions = item.Versions;
foreach(SPListItemVersion version in versions)
    version["Modified"] = new DateTime(2014, 1, 1);

Moreover, properties of SPListItemVersion are read only as well, like SPListItemVersion.CreatedBy

  • Is there no way to change these values?
    – EGwalden
    Commented Mar 12, 2015 at 9:10
  • I am afraid there isn't any way of doing this. At least I couldn't find one. Commented Mar 12, 2015 at 9:13
  • how about re-upload the documents and change the modified date of each one before uploading the next document
    – Mike
    Commented Jul 3, 2018 at 21:16

Please find below a way to manipulate Versions dates via Powershell. Applies to SP2016/2019 (didn't test with an earlier version). Maybe still useful for others:

$DateValue = "2013-01-01 10:05"
$doc["Modified"] = $DateValue
$doc["Created"] =  $DateValue

The latest major version is set to ~10 years ago.

enter image description here

Your Answer

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

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