Wednesday, June 8, 2016

Migrating Lists with Lookup Fields

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...

  1. Create list templates with content,
  2. Create parent lists in destination site,
  3. Note down list GUID for the newly created list,
  4. Rename doc lib the stp file to .cab,
  5. Extract the manifest.xml file,
  6. Look for the old list id and replace it with new list id,
  7. Create a new project in VS - CAB Project. I had to download the template from Microsoft site,
  8. 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,
  9. Build the project, go to debug\bin folder,
  10. Find the .cab file and rename it to .stp,
  11. Upload the template to the gallery & create a list/library out of it,
  12. That's It.
Its a bit of workaround, but if you have a large list then this is your saviour.