Monday, December 22, 2014

SharePoint 2013: a review of all methods and their steps for moving document libraries

Introduction

Sometimes, you need to move a document library to another site, such as an archive site.  This can be done in several ways:
  • Save as template using the Include Content option
  • Bulk copying using the site collection Content and Structure tool
  • Bulk copying via Windows Explorer
  • Moving using stsadm
  • Moving using PowerShell
  • Third party tools
This posting reviews each of these methods from a SharePoint 2013 perspective.

Save as Template using the Include Content option
  1. Pros
    1. Easy to use.
    2. Easy access to template after you're done - it's stored in the site collection template gallery.
    3. effectively creates a backup copy.
    4. Does not require advanced knowledge of PowerShell.
    5. Can be done entirely through the web interface.
    6. Preserves all public views.
  2. Cons
    1. Limited to maximum template size set by administrator.
    2. Cannot specify security or version settings.
    3. Does not preserve version history.
    4. Requires at least Design level permission.
    5. No log file generated.
  3. Procedure
    1. Login to the site using an account that has at least Designer level permissions.
    2. Navigate to the target site document library.
    3. Click the LIBRARY tab to display the Library ribbon.
    4. In the Settings group, click the Library Settings button.
    5. In the Permissions Management list group of links, click Save document library as template.
    6. Enter desired template and file names, check the Include Content checkbox; and then click OK.  The document library is then stored in the site collection's  List Template gallery. 
      If the list is larger than about 50 MB, you will experience an error.
      To resolve this error, increase the maximum list template size.  See the references in this section for details.
    7. Click the Settings gear icon, and then click Site Settings.
    8. In the Web Designer Galleries group, look for List templates
      If you don't see it listed here, be sure you are at the site collection level.  You can check this by looking in the Site Collection Administration group: if you can see the link, Go to top level site settings, click it.
    9. Click the link, List templates.
    10. Verify that your document library template is listed.  Click the Edit button to modify the template title and filename.
    11. Now, navigate to the site where you want the document library moved to. 
      This site must exist in the same site collection as the source document library.  If it isn't you can still move it, but you will need to download the template WSP file from the source site collection list template gallery and then upload it to the destination site collection list template gallery.  The list template gallery is just a document library, so, you know how to do this.
    12. Click the Settings gear icon, and then click Site contents.
    13. Click the add an app icon.
    14. Follow the usual steps for adding a new app (ie, document library), only this time choosing the document library template you created.  This creates the document library along with all its content. 
      Note: the document properties Created by and Modified by will be changed for those users who have since left your organization and no longer have Active Directory accounts.  SharePoint will change these to the user account that performed the Save as Template operation.  If you need to preserve such information, you must either copy it to new, custom properties or use a third party tool  
  4. References
    1. SharePoint 2010: The list is too large to save as a template
    2. What is the Size Limit for Saving a Document Library as a Template (SharePoint 2010)
    3. How to use Powershell to set Max template document size
    4. Increase Maximum size of Site, List Templates in SharePoint
    5. Copy or move a library by using a library template
    6. Save, download, and upload a SharePoint 2013 site as a template
    7. SPWebService.MaxTemplateDocumentSize property
    8. Software boundaries and limits for SharePoint 2013
  5. Notes
    1. Default maximum document size template: this would seem to be 50MB, per this Microsoft article: Save, download, and upload a SharePoint 2013 site as a template. However, in actual practice, I have found it to be 52.428800 MB. This value was obtained by executing
      $webservice = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
      $webservice.MaxTemplateDocumentSize
      in an elevated SharePoint PowerShell Management shell on a newly deployed SharePoint 2013 farm for which this setting had not yet been modified.
Bulk Copying/Moving using the Site Content and Structure tool (Site Manager)
  1.  Pros
    1. Does not require knowledge of PowerShell.
    2. Can be done entirely through the web interface.
    3. Existing security settings are migrated.
  2. Cons
    1. Cannot specify security or version settings.
    2. Version history migrated inconsistently (some are, some are not).
    3. Significant complications if document library employs folders: can only be used to copy subfolder by subfolder.
    4. Only works to copy documents from one location to another within the same site collection - does not work for copying documents across site collections.
    5. File size limited to whatever is set for the farm.
  3. Procedure
    1. Login to the source site using an account that has at least Designer level permissions.
    2. Navigate to the target site document library.
    3. Click the LIBRARY tab to display the Library ribbon.
    4. In the Settings group, click the Library Settings button.
    5. In the Permissions Management list group of links, click Save document library as template.
    6. Enter desired template and file names, and then click OK. The document library is then stored in the site collection's List Template gallery. 
      Do not check the Include Content option.
    7. Click the Settings gear icon, and then click Site Settings.
    8. the Web Designer Galleries group, look for List templates.
      If you don't see it listed here, be sure you are at the site collection level. You can check this by looking in the Site Collection Administration group: if you can see the link, Go to top level site settings, click it.
    9. Click the link, List templates.
    10. Verify that your document library template is listed. Click the Edit button to modify the template title and filename.
    11. Now, navigate to the site where you want the document library moved to.
      Note: This site must exist in the same site collection as the source document library. If it isn't you can still move it, but you will need to download the template WSP file from the source site collection list template gallery and then upload it to the destination site collection list template gallery. The list template gallery is just a document library, so, you know how to do this.
    12. Click the Settings gear icon, and then click Site contents.
    13. Click the add an app icon.
    14. Follow the usual steps for adding a new app (ie, document library), only this time choosing the document library template you created. This creates an empty document library that has the same configuration as the source library.  You need source and destination libraries in order to use the Content and Structure tool, because this tool only copies content from one location to another.
    15. Click the Settings gear icon, and then click Site Settings.
    16. In the Site Administration group, click Content and structure.
    17. Using the tree navigation at left, select the document library that you want to move.  Once you select it, its contents will appear in the Results panel.
    18. From the View dropdown, select a view that presents a simple list (no folders) of all of the documents.  By default, 100 items will be shown.
      Note: if your document library employs folders, for some reason, the Site Content and Structure tool will show these even if you select a previously configured view that specifically excludes them.  For example, if your document library employs folders, you can create a simple list view that presents the documents as a single list without folders, and this view works just fine when you are looking at the contents of the library while connected to the document library's page.  On the other hand, the library folders will appear in the left navigation as subitems under the document library.
    19. Check the documents that you want to copy - don't use the Move option or you otherwise will not be able to verify that all of them were copied over. 
      Note: for document libraries employing folders, you will only be able to copy items over subfolder by subfolder.  For example, if two documents lie buried three subfolders deep, it will not work to check these, select another subfolder, checking those, and then selecting Copy from the Actions menu: only the currently visible and checked items will be copied.
    20. Once you have select afrom the Actions menu, select Copy.  A popup will appear presenting the usual site collection tree structure.
    21. Expand the tree to the empty document library that you created back in steps 14, and then click OK.  The popup will close, and you will see progress information appearing temporarily.  Once done, select the new library and you will see listed the documents that you copied over.
    22. Repeat this process for all the documents that you want to copy.
    23. At the end of this process, use simple column counts to verify that all documents have been copied over. 
    24. Once the copied items have been verified, delete the source list or library.
  4. References
    1. How to Use the Site Content and Structure Manager in SharePoint 2013
    2. SharePoint 2013: Moving Lists using the Site Content and Structure Tool
    3. Software boundaries and limits for SharePoint 2013
  5. Notes
    • I found moving lists this way to be advantageous when needing to preserve list item IDs.
Bulk Copying/Moving via Windows Explorer
  1. Pros
    1. Simple to use.
    2. User permissions in Windows Explorer are consistent with user permissions to document library.
    3. Does not require elevated permissions.
  2. Cons
    1. All version history is lost.
    2. All security configuration is lost.
    3. Metadata (column) properties may be lost or misinterpreted.
    4. Must have Contribute (write) permission to destination library.
    5. No log file generated.
  3. Procedure
    1. Navigate to the source document library.
    2. Select the LIBRARY tab.
    3. In the Connect & Export group, click the Open with Explorer button.  Leave this open. 
      The open with Explorer functionality requires 32-bit ActiveX.  This button will not be enabled if using 64-bit Internet Explorer, Chrome or other browsers not featuring native 32-bit ActiveX support.  Add-ons are available for some of these other browsers, such as Chrome, that will emulate 32-bit ActiveX.
    4. Navigate to the destination document library.
    5. Select the LIBRARY tab.
    6. In the Connect & Export group, click the Open with Explorer button. Leave this open.
    7. Copy documents from the source folder to the destination folder.
    8. Once the copied items have been verified, delete the source list or library. 
      You must delete the library through the library settings page.  You cannot delete it through the Windows Explorer window.
  4. References
    1. Copy or move library files by using Open with Explorer
    2. How to use the "Open with Explorer" command and how to troubleshoot issues with this option in SharePoint Online
    3. Plan browser support in SharePoint 2013
    4. IE Tab Extension for Chrome
  5. Notes
    • To determine whether Internet Explorer is 32 or 64 bit, select About Internet Explorer from the Help menu.  If the browser is 64-bit, the Version will indicate this.
Moving using stsadm
  1. Pros
    1. Simpler permissions to use.
    2. Finer control over export.
    3. Preserves security and most version history.
    4. Generates log file for export and import operations.
  2. Cons
    1. Must be member of local administrator's group.
    2. Deprecated.
  3. Procedure
    1. Open a command shell on a SharePoint farm server.
    2. Execute the following command:
       
      stsadm -o export -url "<source library url>" -filename " "<save file path and name>" -includeusersecurity -versions 4.
       
      1. Source Library URL is URL seen in the address bar when viewing the library.  So, if the library is in site Marketing and is called Documents, the URL you would enter would be: http:/Contoso/Marketing/Documents.   Note that you don't include the extra part that points to the particular view, such as "Forms/Allitems.aspx."
      2. Save File Path and Name is local or network location and file name.
    3. In the same browser, execute the following command:

      stsadm -o import -url "<destination library url>" -filename "<file path and name>"
       
    4. Delete the source library.
  4. References
    1. Index for Stsadm operations and properties (Office SharePoint Server)
    2. Some key differences between stsadm export and backup operations
    3. Stsadm to Windows PowerShell mapping in SharePoint 2013
    4. Complete reference of all STSADM operations (with parameters) in MOSS 2007 SP1
    5. Exporting and Importing site, library or list using STSADM SharePoint Administration tool
    6. Export: Stsadm operation (Office SharePoint Server)
  5. Notes
Moving using PowerShell
  1. Pros
    1. Can be scheduled as a task
    2. Finer control over export process via parameters
    3. Generates log file
  2. Cons
    1. Requires advanced scripting knowledge.
    2. Must be member of SharePoint_Shell_Access role.
  3. Procedure
    1. Login to any SharePoint server using an Administrator account.
    2. Launch an elevated instance of the SharePoint Management Shell.
    3. Execute the following:
        Export-SPWeb -Identity "<sourceurl>" -ItemURL "<itemUrl>" -Path "<path>" -IncludeUserSecurity -IncludeVersions "All" -CompressionSize 1000 -Force
      1. <sourceurl>: this is the url to the site containing the document library.  If the site containing the library was Marketing, you might enter something like this: http:/SharePointFarm.Com/Marketing/.  That's it.  Nothing else.  Note the concluding forward slash.  I left out one of the begining forward slashes so that it wouldn't be rendered in this page as a hyperlink.
      2. <itemUrl>: this is the name of document library and the extra portion containing the view.  For example, if the document library was called Documents, you might enter something like this: Documents/Forms/AllItems.aspx.  Note that it does not start with a forward slash.
      3. -CompressionSize 1000 -Force: these last parameters ensure that the export generates a single file.  Note that compression size is in MB.
    4. After finishing the export, import the file to its new location by executing the following:
      Import-SPWeb -Identity "<destinationurl>" -Path "<path>", where
      • <destinationurl> is the URL to the site to which you want to import the library.  For example, if your site was marketing, it would be htp://contoso.com/marketing/.
      • <path> is the path and file name of the list to be imported.  For example, if the file was stored in the Imports folder off the root, it would be: C:\Imports\MyLibrary.cmp.
  4. References
    1. Import-SPWeb
    2. Export-SPWeb
    3. Export sites, lists, or document libraries in SharePoint 2013
    4. Import a list or document library in SharePoint 2013
    5. Cannot find an SPWeb object with Id or Url
    6. Get-SPWeb : Cannot find an SPWeb object with Id or Url
    7. Software boundaries and limits for SharePoint 2013
    8. SharePoint 2013: To export a site, list, or document library
    9. Export/Import-SPSIte :- What is the max size limit that can be moved using this command??
    10. Use Windows PowerShell to administer SharePoint 2013
  5. Notes
Using Central Administration
  1. Pros
    1. Finer control over export process via parameters
    2. Can be performed online using simple web interface
    3. Doesn't require advanced knowledge
    4. Generates a log file.
  2. Cons
    1. Requires user to be a member of the farm administrator's group
    2. Can only be used to export list - cannot be used to import a list.
    3. No control over other parameters, such as compression or multiple files
  3. Procedure
    1. Launch Central Administration
    2. Go: Backup and Restore > Granular Backup > Export a site or list
    3. Configure as appropriate
    4. Click the Start Export button. 
      If a local URL is entered (eg, D:\test.cmp), the file will be saved to the farm application server that is hosting Central Administration.
    5. To then import this, you must use PowerShell or stsadm. 
  4. References
    1. Export sites, lists, or document libraries in SharePoint 2013
    2. Software boundaries and limits for SharePoint 2013
    3. SharePoint 2013: To export a site, list, or document library
  5. Notes
Third Party Tools
  1. Pros
    1. Can preserve all version history and security information
    2. Don't require advanced technical knowledge
  2. Cons
    1. Legal and regulatory Import/Export considerations (if vendor is foreign to your country)
    2. Costs
  3. Listing
    1. SharePoint List Transfer
    2. CopyMove for SharePoint 2013
    3. Content Matrix
    4. ShareGate
    5. Kroll Ontrack PowerControls
  4. Notes

No comments: