This post is based on Gitolekha’s blog post with added explanations and tool-set especially for finding list GUIDs and how you can alternatively convert cab files to stp files.
I have a parent list called Tracking and a child list called Org i.e. in the source site. My parent list, Tracking has a lookup column called orgcode. A child list called Org has the column orgcode.
I have several data already populated in the parent list. I was asked to migrate the Tracking list with its data from its current location to a diffrent site/could be a different farm or web application. The client do not want any data loss.
You might think saving the Tracking list as template with data will do the trick. Unfortunately, saving the Tracking list as template with data and exporting it into your destination site will only have partial data. That means lookup column data gets lost in the process. This problem occurs because list template does look up on a table using GUID. In creating a list template and exporting to a different site this GUID changes, hence it is no longer able to retain the values.
This is how I tackled this issue:
- Save the child list, Org, as template i.e. with data.
- Add this list template into your destination’s list template gallery library. Its url is http://your site/sites/[site collection name]/_catalogs/lt/Forms/AllItems.aspx.
- Create a new list called Org, in your destination site, based on the Org list tempalte that you created in step #2.
- Find the guid of the newly created, Org, list using this wonderful utility tool.(http://weblogs.asp.net/soever/sharepoint-development-handy-little-utility-to-get-guid-s-and-attribute-names).
- Go to your source site and find the guid of the Org list from the Source site using the same utility tool.
- Go to your source site and save the Tracking list with data as template. This will create a file with .stp extension. Have a copy of this file into your working folder.
- Go to the folder where you saved the Tracking list template i.e. the .stp file and rename the file extension into .cab.
- Double click this .cab file.
- Right click the manifest.xml file and extract it by selecting your working folder.
- Now open the extracted manifest.xml file and look for the child list’s source guid as captured in step #5
- Replace source child list’s guid with destination child list’s guid as captured in step #4.
- Now convert your edited manifest.xml cabinet file into stp file using makecab.exe as follows.
- Run your command prompt tool -> go to the folder where the edited manifest.xml is located and run the next command line
- … makecab.exe manifest.xml NewTrackingList.stp
Now import the edited stp file i.e. NewTrackingList.stp into your destinatiion site and create a new list instance. If you check your newly created parent list, you will see all column data intact with lookup column included.