Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |

Thursday, July 26, 2012

Migrating List which contains Lookup Fields from one Site to another Site including Data:



I have got requirement like, move/migrate the list with content from one site collection to another site collection.
Below are my approaches:
  1. Save the list as list template with include content.
  2. Download those list templates and save it into your local server.
  3. Go to “list template” gallery of another site collection and uploaded all the list templates.
  4. Create the list with based on the list templates. That’s it.
But one problem will arise here. I.e. the lookup fields are broken because lookup field referring list GUID is changed.  We can resolve it either by coding or by following below steps


Approach1: Through Coding

Approach2:
Solution: Let me start from scratch
  1. Create a “Department” list and the data on it.
  2.  Create another list with name “Employee” and create a new lookup field “Dept”.
  3.  Finally the Employee list looks like below: 
  4.  Now save both the list as list template with content and download it into local server (C:\MyListTemplates).
  5. Go to the “list templates” gallery of another site collection and upload first the “Department” list template.
  6. First create the new “Department1” list by selecting the “Department” list template.
  7. Now get the GUID of newly created “Department” list. Follow below steps to get the GUID.
    1. Go to the “Department1” list-->Edit list settings
    1. Copy the URL from the browser address bar into Notepad. It will look something like:
    2.  http://intranet-dev/TestAdminForms/_layouts/ listedit.aspx?List=%7BCD033339%2DE42D%2D41AE%2D9E27%2D5E14592C8F4B%7D
      1.  Delete everything before and including “List=”.
      2. Change the “%7B” to “{“
      3. Change all the %2D to “-“
      4. Change “%7D” to “}
    3. You are now left with the Id: { CD033339-E42D-46E0-41AE-9E27-5E14592C8F4B}
  8. Find the “Employee” list template and follow the below steps:
    1. Rename the original .STP to .CAB.
    2. Extract its manifest.xml to a local folder (let’s call it {working folder}).
    3. Search for the keyword “LookUp” and you will get the result like below.
    4.  Now change the List GUID. 
    5. Repackage the manifest.xml into a .CAB. I've done this by using makecab.exe in the “C:\Windows\System32” folder.
    6. Syntax: makecab.exe {working folder}\manifest.xml {working folder}\ {template-name}.cab
    7. E.g. Wrong: makecab.exe D:\SharePoint practice\My Site\ manifest.xml D:\SharePoint practice\My Site\MyList.cab [Note: Don’t give space between the path].
    8. Correct: makecab.exe D:\SharePointpractice\MySite\ manifest.xml D:\SharePointpractice\MySite\MyList.cab
  9. Upload the latest Employee list template into your site and create the new list by selecting “Employee” list template.
  10. Now, your lookup column should not break.
We can do same thing while migrating from SharePoint 2007 to SharePoint 2010 by just changing the product version 3[SP2007] to 4[SP2010]. Please refer my previous post to change the production version.

 I am sharing it after implemented it myself. Please let me if need any help.


3 comments:

  1. I followed your steps and the lookup columns did display properly but when I try to add a new item to the main list I get the message "Sorry, somehthing went wrong". I looked thru the ULS logs and it appears that the error is System.NullReferenceException: Object reference not set to an instance of an object. Any ideas?

    ReplyDelete