One of the basic activity while working on SharePoint site is to migrate lists/libraries from one site to another. If you have a lookup field in the list then the task is not basic anymore.
I faced this issue several times. I never gave it a thought and always used to recreate the list at destination site. But recently I stumbled upon a blog from Maulik Dhorajia who has described this issue in detail.
In my case, I was moving 3 lists & 1 document library. This 1 doc lib had reference (lookup column) to other 3 lists. All the steps were same except I had to add all document in the VS 2013 project along with the manifest.xml file.
Below are the steps in brief...
- Create list templates with content,
- Create parent lists in destination site,
- Note down list GUID for the newly created list,
- Rename doc lib the stp file to .cab,
- Extract the manifest.xml file,
- Look for the old list id and replace it with new list id,
- Create a new project in VS - CAB Project. I had to download the template from Microsoft site,
- Add all the documents along with manifest.xml file to the project. If you are migrating a list, then you will only have manifest.xml file,
- Build the project, go to debug\bin folder,
- Find the .cab file and rename it to .stp,
- Upload the template to the gallery & create a list/library out of it,
- That's It.
Its a bit of workaround, but if you have a large list then this is your saviour.