Exported SharePoint list templates not retaining lookup column data

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:

  1. Save the child list, Org, as template i.e. with data.
  2. 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.
  3. Create a new list called Org, in your destination site, based on the Org list tempalte that you created in step #2.
  4. 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).
  5. Go to your source site and find the guid of the Org list from the Source site using the same utility tool.
  6. 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.
  7. Go to the folder where you saved the Tracking list template i.e. the .stp file and rename the file extension into .cab.
  8. Double click this .cab file.
  9. Right click the manifest.xml file and extract it by selecting your working folder.
  10. Now open the extracted manifest.xml file and look for the child list’s source guid as captured in step #5
  11. Replace source child list’s guid with destination child list’s guid as captured in step #4.
  12. Now convert your edited manifest.xml cabinet file into stp file using makecab.exe as follows.
  13. Run your command prompt tool -> go to the folder where the edited manifest.xml is located and run the next command line
  14. … makecab.exe manifest.xml NewTrackingList.stp

makecab

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.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: