I want to update the property vti_author in an item in a SPDocumentLibrary, but it doesn't work. The items original vti_author is the same even after running this script, why?

$spSite = Get-SPSite http://mySite/
$spWeb = $spSite.OpenWeb("News");
$spDocumentLibrary = $spWeb.Lists["Pages"];
$items = $spDocumentLibrary.GetItems();

foreach ($item in $items)
    $vtiAuthor = $item.properties["vti_author"];

    if ($vtiAuthor.EndsWith("sp_reader"))

        # Check out 
        $file = $item.File; 

        # fails - no read only field
        #$item.properties["vti_author"].ReadOnlyField = false;

        $newAuthor = "DOMAIN\user"; 
        $item.properties["vti_author"] = $newAuthor;  

        # Check in 
        $file.CheckIn("Updated by System");

As suggested here: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/1f42e45e-160f-457d-b4dd-cb228e49abb7

You should use following fields along with UpdateOverwriteVersion() method to update fields such as author, date created etc.

// The actual User Information is within this SPListItem 
                    SPListItem userItem = documentList.Items.GetItemById(1);                   
                    userItem["Created By"] = currentWeb.EnsureUser("user").ID; 
                    userItem["Modified By"] = userItem["Modified By"]; 
                    userItem["Created"] = DateTime.Now.AddYears(-3); 
                    userItem["Modified"] = DateTime.Parse("01/01/2000");
  • Thanx, I'll try this. – Benny Skogberg Apr 23 '12 at 15:15
  • 2
    It didn't work, the vti_author property stays the same. Sorry. – Benny Skogberg Apr 23 '12 at 19:57

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.