Using SharePoint 2013. And I'm using the PowerShell code from here, https://letitknow.wordpress.com/2011/03/17/100/ to copy a list to a new list to a new list. It works great if I'm copying to the same content database, but as soon as I try to copy over to a new content database I lose all the meta data like Created By, and Modified By - just comes up blank.

  • 1
    It isn't the content database that is the problem, it is because of the site collection boundaries. Users are stored at the root of the site collection and vary from site collection to site collection. Jan 18, 2017 at 1:53
  • Thanks Eric, I thought it would be something like that. I just need to figure out how to get around that. Any ideas on how?
    – Marker
    Jan 18, 2017 at 13:33

1 Answer 1


You need to update the script and include all metadata:


$newitem["Title"] = $item["Title"]
$newitem["AnotherField"] = $item["AnotherField"]
$newitem["CreatedBy"] = $item["CreatedBy"]
$newitem["FieldA"] = $item["FieldB"]

For the user fields you would need to work with Microsoft.SharePoint.SPFieldUserValue

This pattern should work for you

$SourceUser = $item["Your SPFieldUserValueCollection Field"]

$DestUserList = new-object Microsoft.SharePoint.SPFieldUserValueCollection #this is required if you have multiuser filed
$DestUserList.Clear() #this is required if you will use it for multiple fields

$DestUser = $DestWeb.ensureuser( $SourceUser.User ) #this adds user to the user information list
            $userValue = new-object Microsoft.SharePoint.SPFieldUserValue($DestWeb, $DestUser.ID, $DestUser.LoginName)

$newitem["Your SPFieldUserValueCollection Field"] = $DestUserList
  • Thanks Marek, I did modify the code to fit my list. It's that any fields that have user names (People Pickers) won't copy the name over to a new content database. See Eric's comment above.
    – Marker
    Jan 18, 2017 at 16:22
  • @Marker updated with handling the user information. Jan 19, 2017 at 10:36
  • Thanks Marek, I'm trying this out but I get an error "Exception calling "EnsureUser" with "1" argument(s): "The specified user could not be found." I'm using $SourceUser = $item["Created By"] and when I look at the $SourceUser variable contents it equals "934;#Long, Kevin". I know Kevin is a recognized in SharePoint. This is just one example, all names give the same error. Not sure why I'm getting this error.
    – Marker
    Jan 23, 2017 at 14:08
  • and what you get when you check $SourceUser.User? that should be in domain\uname format and then you should be able to call ensure user correctly. Ensure user adds that user to the user information list and needs to be called with correct domain\uname. Jan 24, 2017 at 15:15

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.