Thursday, July 7, 2016

Copying a SharePoint list from one site to another

Copying a SharePoint list from one site to another as there are many approaches. There are many options available such as,

  • Saving as a list template
  • Using PowerShell
  • Inline Copy and paste and etc...

Depending on the level of information you have, you might need to consider using a third-party tool as well when you have a complex structure that may include different site columns and so on. Migrating SharePoint data from one to another is a different BUSINESS.

In this article I will explain one of the ways that we fixed a problem that appeared to be complex.

Our scenario was as follows. 

  • Had 3 fields with HTML contents
  • 2 Lookup fields
  • Many other field types (Single line of text, Boolean and etc...)

Using PowerShell against copying HTML fields was not succesful at the first instance as there are many string literals that need to be taken care with. So we are left with a simple option to export the list from one site and import to another. 

This approach worked perfect for everything except the Lookup fields. Lookup fields are internally handled with the id of another fields in the lookup list. Therefore first we deleted the two fields and added them. Then we used a simple PowerShell script that takes the Lookup value of the source list item and find the lookup id within the destination list and update it. This way it was less trouble and faster. 

No comments:

Post a Comment