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.

Wednesday, November 11, 2009

Site Migrations in MOSS

Managing Sites & Site Collections with STSADM
1. Backup a site collection:
stsadm -o backup -url http://url/ -filename .cab

2. Restore a backed up site collection:
stsadm -o restore -url http://url -filename .cab

3. Backup a single site:
stsadm -o export -url http://url/sitename -filename .cab
stsadm –o export –url http://url/sitename –filename .cab –includeusersecurity –versions 4 –cabsize 1024 –nofilecompression

4. Restore a single site:
stsadm -o import -url http://url/sitename -filename .cab
stsadm –o import –url http://url/sitename –filename .cab –includeusersecurity –updateversions 3 –nofilecompression

Here are interesting problem solving solutions based on the above:
  • Move or Copy a site collection: #1 followed by #2
  • Move or Copy a site: #3 followed by #4
  • Convert a site into a site collection: #3 followed by #4 on a top site URL
  • Convert a top level site collection into a site: #3 targeted to the top level URL followed by #4.
  • Break Apart a content database: Use stsadm -o createsiteinnewdb to create a top level URL first, and then use #3 and #4 on that target URL.

Note: Run the STSADM commands with Site Collection Administrator rights account.

World Clock