Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Squadron for SharePoint 2010 – Copy Items

Posted by Paul on December 18, 2012

In this article we can explore new feature integration to our Squadron Tool for SharePoint 2010.


Copy Items

The Copy Items functionality is simple as the name implies:

· It copies list items from source server list to destination server list

It helps us in the following ways:

1. Quick Creation of Lists from server to another

2. Duplication of Items if the lists are same

3. Multiple List copying

We can use the tool to copy multiple lists across sites..



Squadron 2010 is a Utility Add in Application for SharePoint 2010. It is available for download from:

The method performs the following:

1. Accepts a Source List Item and Destination List

2. Creates a New List Item inside Destination List

3. Iterates over each Field of the Source Item and copies the property to Destination Item

4. Discards field names of ‘Attachments’

5. Updates the list item on the end of method

Start using the Tool

You can download the tool from above location.

Step 1: Execute the Tool

You will get the following screen on execution.


Step 2: Click Copy Items

Click on the Copy Items item from the left pane and you will see the following add-in.


Step 3: Source Server Connect

As the screen implies, you have to do the following steps of actions:

Step 1: Source Server Connect In this step input the URL of the Source Server. You can enter the user name if needed higher permissions. (By default it is SHAREPOINT\system)

For the time being enter your SharePoint site url here:


Then click the Refresh button. You will get the Lists loaded in the Step 2 box as shown below.


Step 4: Source List Select

Check those lists which you wish to copy. For the time being I have checked 2 lists.


Please note that the Number of List Items are shown within Parenthesis.

Step 5: Destination Server Connect

In this step input the URL of the Destination Server. You can enter the user name if needed higher permissions. (By default it is SHAREPOINT\system)

You can choose the same Site URL, if you wish to create duplicate items.

You can choose a different Site URL, to create the list and copy the items. Please note that the new List created will be having same List Template & Quick Launch property as the Source List.

For the time being I have created another sub site inside the local host. My URL would be:


After entering the URL click the Refresh button to the right.


You will see the Step4: Finalize section populated with the Source & Destination list names.

Please note that if there is no destination list, a new list will be created & items will be copied.

If there is a destination list with incompatible structure, the copying for the particular list won’t be performed.

Step 5: Copy Items

This step performs the COPY operation. You can see the progress through the progress bar and log message box. Click on the COPY button to start copying.


Within a few seconds the copy operation will be completed and you will get the STATUS BARS updated as shown above. The log box will be displaying the copy operation details.


For reference purpose I have attached the source code for Copy Items along with this article.

Step 6: Verifying the Data

Now we can go back to the new SharePoint site to verify the Lists & Data. You can see that there are 2 new Lists created & items are copied.

Following is the data for Contacts list in the destination site.


Following is the data for Tasks 1 list in the destination site.



The current functionality only allows List items copying. In future Library items copying will be included.

Underlying Code

The underlying code that performs the Copy Items functionality is following method:

private void CopyItem(SPListItem item, SPList destList)


SPListItem newItem = destList.Items.Add();

for (int i = 0; i < item.Fields.Count; i++)

if ((!newItem.Fields[i].ReadOnlyField)

&& (newItem.Fields[i].InternalName != "Attachments"))

newItem[newItem.Fields[i].InternalName] = item[newItem.Fields[i].InternalName];



In case of the Destination List is not existing, we need to create a new List with the same structure. Following is the code that performs the same.

private SPList CreateList(SPWeb sourceWeb, SPWeb destinationWeb, string stitle, string dTitle)


SPList slist = sourceWeb.Lists[stitle];

Guid dguid = destinationWeb.Lists.Add(dTitle, slist.Description, slist.BaseTemplate);

SPList dlist = destinationWeb.Lists[dguid];

dlist.OnQuickLaunch = slist.OnQuickLaunch;


return dlist;


Copying between incompatible list structures are not allowed. The check is performed by the following code:

private bool IsStructureValid()


SPList sourceList = SourceWeb.Lists[SourceListName];

SPList destList = DestinationWeb.Lists[DestinationListName];

for (int i = 0; i < sourceList.Fields.Count; i++)


string fieldName = sourceList.Fields[i].Title;

if (!destList.Fields.Cast<SPField>().Any(f => f.Title == fieldName))

return false;

if (destList.Fields[fieldName].Type != sourceList.Fields[i].Type)

return false;


return true;


This concludes our article on Copy Items add-in for Squadron. I hope this add-in will be useful.



In this article we have explored the Copy Items functionality of Squadron. You are free to download the tool and start using it. As always I am listening for new & new features integration into Squadron.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s