1

Is there a method to change the Document owner for multiple documents in a document library with versioning?

We have a large number of documents which are assigned to a user who no longer belongs to the company, and a large number which need to be 'handed over' from one user to another.

0

If Document Owner is a User field then using PowerShell would be your best approach:

Add-PSSnapin Microsoft.SharePoint.Powershell
$web = Get-SPWeb "http://server/sites/website"
$library = $web.Lists["Display Name of your library"]
$oldUser = $web.EnsureUser("DOMAIN\OldUserAccount")
$newUser = $web.EnsureUser("DOMAIN\NewUserAccount")

foreach ($item in $library.Items)
{
   $userfield = New-Object Microsoft.SharePoint.SPFieldUserValue($web,$item["DocumentAuthorColumnInternalName"].ToString())
   $login = $userfield.User.LoginName
   if ($login -eq $oldUser.LoginName)
   {
      $item["DocumentAuthorColumnInternalName"] = $newUser
      #if you are using default "Author" column, you need to set the following as well:
      #$item.Properties["vti_author"] = $newUser.LoginName
      $item.UpdateOverwriteVersion() #this saves changes without incrementing the version
   }
   $login = $null
}

$web.Dispose();
  • Thanks, thought the answer may lie in powershell. I will give it a go. – SarahM Dec 2 '15 at 14:35

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.