My issue is that I have two lists that I would like to move with their data. While I am able to save both as templates and then upload to the new site, none of the lookup columns in my parent table are populated with data now. Can this be done?
5 Answers
Not to my knowledge. I've always chalked this up to that when the lists are saved, the look-ups are dropped because there is no guarantee that when the lists are provisioned, that the other dependent list will exist, so it can't save the data.
Something I've been meaning to try is to provision the lookup list first then provision the main list and see if the data will still exist. My inclination is that it won't. However, if you export the main list to Excel, provision the list from the template, then go into datasheet mode, you should be able to paste the data from Excel into the list and be back up and running.
-
1yup, this seems like the only way... very pitty tho, especially if you have large amounts of lists/data– int32Aug 17, 2011 at 7:59
I have the same need. I've come across this solution: https://danielthenerd.wordpress.com/2012/06/14/list-template-lookup-by-list-name-not-guid/
Basically, taking the STP, converting it to a CAB, extracting the Manifest.xml, editing it so that the GUID reference is replaced by a name, since the GUID is auto-generated at "run-time".
<Field Type="Lookup" List="Lists/NameOfListToLookup"/>
This works, when creating lists manually (via the UI) - the lookup is preserved.
In our case, I'm trying to create lists via a Visual Studio-generated WSP (feature which dumps the STPs, instantiates lists), with an event receiver to create the lists (List being looked up and another list referring to the first). We were also able to create the lists with the WSP "method".
-
Very nifty trick to avoid multiple editing of List GUID. Thank you Apr 19, 2017 at 9:47
Gary LaPointe has written some particularly ace extensions to stsadm
that allow you to import, export, and copy lists (among many other things).
The documentation for these commands can be found here: Import/Export/Copy Lists
I've used these in the past to move lists containing lookups around successfully; I'm pretty sure the lookup values and IDs had an option to be preserved.
How to produce this issue. - We have created 2 lists "Gender" and "Actors". Gender is going to be a lookup field in actors. After filling some data both the list.
Save both list as a template with the content included. In this current example, i have given the names as "Template Gender" and
"Tempate Actors".Download the stp files from the Site Settings > List Templates.
Create another site. Upload the tempates Site Settings > List Templates.
If you don't want to create another site than delete both list from current site.
Once the template gets added. Use the template to create a list. In the below given images "Gender" List comes up fine but "Actors" List
is not having anything in the "Gender" column field.Solution
Download the "Template-Actors.stp" file from "List Templates".
Rename the file and change the extension of the file from ".stp" to ".cab".
Once you have the extension as ".cab", extract the "Manifast.xml" file.
Get the List ID of newly created "Gender".
Replace the old value List Id in Lookup of Gender to New List ID
After making the changes save the xml file.
To recreate a CAB file open "Microsoft Visual Studio". Create a "CAB Project". In this case i have created "Template-Actors".(We can also use makecab.exe instead of visual studio.)
Add the file Manifast.xml to the project.
Build the cab project. Go to debug\bin folder you will find "Template-Actors.cab".
Rename the file to "Template-Actors.stp".
Upload the file to "List Template".
Create a list using new template.
The gender selections will now show up.
please look at the link below
-
1