13

I'm in the process of upgrading/cleaning up a large Web Application with a lot of Site Collections. On a SharePoint Foundation 2013 env.

I have found some questions about moving document libraries and lists but nothing really covers it good. At least not what from what I have found.

Is there a way to move Libraries and/or Lists from one site collection to another on the same web application without effecting any metadata on the files and keeping all versions of document/ListItems.

I would preferably like to do this using PowerShell.

Have any tips/links?

Another SPSE question that this question might be a duplicate of, but i don't believe the answer covers if there is a way to to this with PowerShell.

UPDATE

I have now investigated this more and tested some different ways to move Lists and Libraries.

  • Granular Backup and Restore (BennySkogberg)

    • This worked but some metadata was lost. I found that user fields like custom user fields, Created By, Modified by and Create Date and so on, was not kept. Sadly, other ways this was easy to do.
    • How to: In Central Admin go to Back Up and Restore -> Granular Back up -> Export a site or list. Use PowerShell to Import it. (Import-SPWeb http://site -Path export.cmp -UpdateVersions Overwrite)
  • Save List as Template, Include Content.

    • Sometimes Include Content is "greyed-out".
  • Using code.

    • Looses Metadata if I move SPFolder. (Time consuming if I recreate the list on a different site collection and move all items and tag the metadata per document.)
7

The Metalogix has a very cool tool. With this tool you can migrate lists, sites, libraries and others items.

Refer to Content Matrix Product Page

Also refer to Introducing Content Matrix Console - SharePoint Edition

  • Late response but I've tried metalogix and it works great. – George Norberg Jul 3 '15 at 12:12
  • ShareGate too works great! – userAZLogicApps Sep 27 '18 at 12:05
15

I'm going to go over this in a bit more detail, because none of the above answers were clear to me.

How to Move a SharePoint List from One Site to Another

1. Go the the List Settings of the list you want to move 2. Click Save list as template

enter image description here

3. Give the list template a descriptive file name, template name, and description

4. Go to the site's List Template Gallery

  • To do this go the the Site settings

  • Then List templates

enter image description here

5. Click your list template to download as a .stp (Sharepoint Template Pack) file

enter image description here

6. Now, navigate to the site you want to move this list to

7. Go to the destination site's List Template Gallery

8. Click Files -> Upload Document, and select the stp file you downloaded

enter image description here

9. Go to the Site Contents of the destination site, and click add an app

10. Your uploaded templates will now be listed under Apps you can add

enter image description here

  • Hi, when I uploaded my list in the destination site, AllItems page gave me this error: "List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user". What does it depend from? – johnny_kb Aug 31 '17 at 13:22
  • If you can't see the 'save list as template', that's because MS hid those several options for O365 group site. To enable it, connect to SPOService and update site setting via Set-SPOsite <Site-URL> -DenyAddAndCustomizePages 0 and replace listedit.aspx? with savetmpl.aspx? in the URL. ref: answers.microsoft.com/en-us/msoffice/forum/… – KuN Oct 5 '18 at 16:25
1

The Export-SPWeb command is available for your help

another approach: the below code will move items from from one list another list in one site collec to another list in another site collec.
This can be executed in a console appln.

    SPSecurity.RunWithElevatedPrivileges(delegate()
      {
        using (SPSite srcSite = new SPSite("http://srcSite1"))
        {
          using (SPWeb srcWeb = mrcSite.OpenWeb())
          {
            SPList srcList = srcWeb.Lists["mydoclib"];
            SPListItem item = srcList.GetItemById(id);

            using (SPSite tgtSite = new SPSite("http://tgtSite"))
            {
              using (SPWeb tgtWeb = tgtSite.OpenWeb())
              {
                SPFolder tgtFolder = tgtWeb.Folders["tgtdoclib"];

                tgtWeb.AllowUnsafeUpdates = true;
                tgtFolder.Files.Add(item.File.Name, item.File.OpenBinary(), true);
                tgtFolder.Update();
              }
            }
          }
        }
      });

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 1
    Can you elaborate on that? More specific? – George Norberg Dec 12 '14 at 12:16
  • Can you provide some explanation on how to do this? Answers that don't include explanations may be removed. – wjervis Dec 12 '14 at 13:13
0

We have an internally built PowerShell that does this for libraries but doesn't take into account any metadata.

My best bet would be to try a 3rd party software called Sharegate as it can take care of all your data, metadata included. We have used the software with 2 of our customers and it works like a dream. ( NOT employed by Sharegate )

  • Why would I use a third-party software for this when I can use SharePoint Functionality. I assume that you internally built powershell script creates a new library and moves the documents then. That is not the way I want to do this. – George Norberg Dec 12 '14 at 12:43
  • Correct. it takes the designated library with subfolders and documents and puts it where we want it to. But while testing we did find out that we could hook into the few metadata the documents had on them. We chose not to do it that way as out metadata on the documents was too out of date so we ended up doing something different. – Cherubel Dec 12 '14 at 12:56
0

Here is a very good resource for what you are looking for. Everything is explained in detail. link I am explaining here as requested. If you prefer PowerShell its great because it's best way to preserve your metadata. You can use Export-SPWeb command with 'include version' parameter value as 'current version' or 'All' if you want to keep all versions. You also have the option to include all security settings. After exporting the list you have use Import-SPWeb command to import that list to target site. You can use 'update version' parameter to specify what you want to do in case of existing items. you can use 'ignore' or 'overwrite' as per your requirement. Its fairly simple.

0

Wouldn't it just be easier to save the list as a template (including content), then creating a new list - using that template - in the desired site?

I actually just had this problem, and went with this solution. Powershell and third-party tools could be necessary if you're crazy customized or have humongous lists, but this method worked for me just fine.

0

Through powershell you can copy the list and libraries from source site and can deploy to destination site without breaking the connection of lookup column present in lists.

You can find solution in the below URL: http://sharepointvspowershell.blogspot.in/2015/08/migrate-sharepoint-list-with-its.html

  • Would you be able to post some content from the link you have provided. Sometimes links break, it would be nice to have users some content to read here on this site. – Asad Refai Aug 11 '15 at 9:54
  • Thanks for comments. But the essential parts of the solution i.e code part contains more 170 lines. Shall I post it? – Asish Aug 12 '15 at 6:16

protected by Community Aug 11 '16 at 16:34

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.