I copied files from a document library to another using powershell. But in new document library, for all files, created by column is the system account. I want to update this value to author of the original file. When I try to edit using powershell is gives me ""Author" is a ReadOnly property." error.

Here is a piece of code. How can I edit the author property?

$sWeb=Get-SPWeb $sourceWebURL
$sList=$sWeb.Lists | ?{$_.Title -eq $sourceLibraryTitle}

$dWeb=Get-SPWeb $destinationWebURL
$dList=$dWeb.Lists | ?{$_.Title -eq $destinationLibraryTitle}


foreach($RootItem in $RootItems)

    Write-Host   $RootItem.Title " copying..."
    $sBytes = $RootItem.OpenBinary() 
    $dFile = $dList.RootFolder.Files.Add($RootItem.Name, $sBytes, $true) 
    #Write-Host $RootItem.Author

    $fieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue($sWeb.RootWeb, $replacedUser.ID, $replacedUser.LoginName);
    #Write-Host $fieldUserValue



    Write-Host $counter " item copied"    

  • I notice that you are taking items from $sList, and updating the items of $sList, with its own value, is it what you are trying.? – Karthik Jaganathan Nov 26 '15 at 8:21
  • you are setting the author of $RootItem -> which belongs to $sList (Source) and then finally without setting any value to the destination item, you are updating the $dFile -> which belongs to $dList. – Karthik Jaganathan Nov 26 '15 at 8:33

Try using $dWeb.AllowUnsafeUpdates = "true"; because before updating the read-only fields, we need to enable this, if this doesn't work for you then instead of the $dFile.Update(), try with $dFile.UpdateOverwriteVersion();

Above all the mentioned approaches, please check the logic which you have implemented, I guess the problem is in the logic.


I had the same situation .I followed this Powershell command to change the authors for all SharePoint items.



  • Please add details from the lnks to your answer. As it is written now it will be to no help in the future if the link breaks – Robert Lindgren Nov 26 '15 at 14:21

Call the following code:

$newItem = $dFile.Item

instead of:


UpdateOverwriteVersion is the only method of SPListItem that allows overwriting of Modified/Modified by (aka Editor)/Created/Created by (aka Author) fields.

Also, call it on the new SPListItem object (i.e. $dFile.Item in your case) and not on the SPFile object.

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.