3

The export / import operations seems to be working quite well except for lookup columns. The lookup columns and other columns associated with the lookup are all empty.

Is this a limitation? Is there any script or tool that can overcome this?

Here's my code:

#This is the source web that is hosting the lists to move
$sourceWebUrl = "http://servername/subsite"     
#This is the destination web, where the lists will be copied to
$destWebUrl = "http://servername/sites/subsite"

#Location to store the export file
$path = "\\servername\Backups\"

#comma delimited list of List Names to copy
$lists = @("list2", "list1")


#Loop through the lists, export the list from the source, and import the list into the destination
foreach($list in $lists)
{
  "Exporting " + $sourceWebUrl + "/lists/" + $list

  export-spweb $sourceWebUrl -ItemUrl ("lists/" + $list) -IncludeUserSecurity -IncludeVersions All -path ($path + $list + ".cmp") -nologfile

  "Exporting complete."



  "Importing " + $destWebUrl + "/lists/" + $list

  import-spweb $destWebUrl -IncludeUserSecurity -path ($path + $list + ".cmp") -nologfile

  "Importing Complete"
  "`r`n`r`n"
 }

Source taken from http://blogs.msdn.com/b/jorman/archive/2011/01/08/copying-lists-with-powershell-in-sharepoint-2010.aspx

1

2 Answers 2

5

After migration lookup columns lost relations because list GUIDs they are using are different. This cannot be avoided and this is main disadvantage of using export/import based migration.

Here you can find known issues when using import/export:

1

I have had the same problem (empty lookup fields) after importing libraries. But I could easily solve this problem by changing the order of importing the libraries. At firts I had to import the library which was referenced by the others. Of course this works best with a limited number of libraries, so that you have an overview of which library is referenced by another one.

Hope this helps,

many greetings from Bavaria (Oktoberfest is over now :-() )

Max

1
  • I have the same issue now with SP 2013, having two lists connected via a lookup field. I'v exported both of the lists, and imported the list referenced by the field in the other one first, but it still does not work, even after I set the lookup list id in the field via PowerShell (see an example here: gist.github.com/empo/30221351df9000cc487f). Is there somebody having more success?
    – pholpar
    Oct 3, 2017 at 13:36

Your Answer

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

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