Monday, February 16, 2009

Workaround for Lookup field in SharePoint list templates

If you have ever tried to save a list as a template that contains a Lookup field for one of the columns, you have undoubtedly discovered that the template once implemented on another site will be unable to properly lookup a field for that column. Instead the column will have to be deleted and recreated for each instance of the list.
Todd Bleeker has posted a cool workaround for this issue that can be used on a singular basis (it is not for solving this problem with custom created list definitions). Thanks Todd!
FULL POST HERE
01. Browse to the source Web's lookup list and choose Modify settings and columns.
02. Copy the source lookup list GUID from the URL.
03. Browse to the destination Web's lookup list and choose Modify settings and columns.
04. Copy the destination lookup list GUID from the URL.
05. Save the source Web's list that contains a lookup column to the lookup list as a list template called [yourlist].stp.
06. Export the list template STP from the source list template gallery to the file system.
07. Rename the [yourlist].stp file to [yourlist].cab so Windows can open it.
08. Open the file, right click on the manifest.xml file and export it to
the file system.
09. 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 follows:
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.

No comments: