Print Version Email Page Add to Favorites Comments Alert Me Add to My Links

Wednesday, November 18, 2009

SharePoint: Export List - Retain Lookup Information

The stsadm.exe works well with site migration. However, it does not offer any option to export a list. Therefore to migrate a SharePoint list you need to do the following procedure:
  1. Create a template from the List you want to export (and include the content in the template), download a copy of the .stp template file created.
  2. Then upload the stp file to the List Templates Gallery.
  3. Create the list from the template you have just created.
Have you ever wanted to copy a list that had a lookup field from a source Web to a destination Web using a custom list template (STP)? Even if the destination Web has a lookup list that exactly matches the source Web, the lookup field will be empty in any lists created using the STP. That is because lookup fields are related by GUID.

This is a common problem with custom list templates. The following steps describe the workaround. Assuming that your destination Web already has a lookup list identical to the source Web. Replace [yourlist] with the name of the list you want to move.
  1. Browse to the source Web's lookup list and choose Modify settings and columns.
  2. Copy the source lookup list GUID from the URL.
  3. Browse to the destination Web's lookup list and choose Modify settings and columns.
  4. Copy the destination lookup list GUID from the URL.
  5. Save the source Web's list that contains a lookup column to the lookup list as a list template called [yourlist].stp.
  6. Export the list template STP from the source list template gallery to the file system.
  7. Rename the [yourlist].stp file to [yourlist].cab so Windows can open it.
  8. Open the file, right click on the manifest.xml file and export it to the file system.
  9. Edit the manifest.xml file; find the source Web's lookup list GUID and replace it with the destination Web's lookup list GUID.
  10. Save the manifest.xml file.
  11. Open a VS.NET command prompt.
  12. Run the makecab command as: makecab manifest.xml [yourlist].stp
  13. Import the new STP into the destination Web's list template gallery. You will need to delete it if it has previously been imported.
  14. Create a new list based upon the new STP file.
The lookup column on the new list should retain all the data that was in the source list.


Anonymous said...

When you say "lookup list" does that refer to the column that's a "Picklist" type instead of "Choice"?
Would you have sometimes to provide some screen shots for the beginers like me?


Anonymous said...

To find the GUID to replace
search for:

<Field Type="Lookup"

The change you want to make is to the "List" attribute

Term Papers said...

I have been visiting various blogs for my term papers writing research. I have found your blog to be quite useful. Keep updating your blog with valuable information... Regards

Anonymous said...

If the new lookup list resides in a different website (for instance if you have exported the list to another Sharepoint environment) then you need to change the WebId attribute as well to reflect the id of website containing the lookup list:

List="{9403b563-ce40-44df-aa20-8624a616d963}" WebId="cdf05225-f117-498f-9f5e-c2b7649bdfd1"

MUSTURU said...

Thanks for you are post. I am Moving the Splist Items usinf Coding. How can I do this using C# coding

Thanks & Regards,

Anonymous said...

Thank you very nice!

World Clock