2. Export and Import
SharePoint supports granular export and
import of sites, lists, and libraries. In this section, I shall
demonstrate exporting and importing using the three tools of
choice—PowerShell, STSADM, and Central Administration.
Export and Import Using PowerShell
The following steps demonstrate using PowerShell commands from the PowerShell console to export a site to a file:
- From the Start menu, choose All Programs.
- Click Microsoft SharePoint 2013 Products.
- Click SharePoint 2013 Management Shell to launch the console.
- Type in the following text into the console, replacing the appropriate placeholders:
Export-SPWeb <site/list/library URL> -Path <filename> - To export a specific list or library, provide the full URL to the
list or library, otherwise PowerShell will export the site if the URL
is to the main site location.
- Include the [-Force] option to overwrite the file.
- Include the [-HaltonError] or [-HaltOnWarning] options to stop the export process in the event of an error or warning.
- Specify the [-IncludeUserSecurity]
option if you need to ensure that all permissions applied to exported
sites, lists, libraries, and contained items are included in the export
file.
- Include the [-IncludeVersions] option to instruct PowerShell to include version information of items in the export file.
- Include the [-NoFileCompression] option to turn off file compression; this makes for a faster export but larger files on disk.
- The [-NoLogFile] option prevents PowerShell from creating a log of the export (not recommended generally).
- The [-UseSQLSnapshot] option is the familiar SQL snapshot option for deployments running on SQL Server Enterprise.
Note PowerShell provides help for all commands—you may get help on the export command by typing Get-help Export-SPWeb into the PowerShell console.
In partner to the export command, the following
step demonstrates importing an export file to a SharePoint site, list,
or library:
- 13. Type the following text into the console, replacing the appropriate placeholders:
Import-SPWeb <site/list/library URL> -Path <filename>
To import a specific list or library, provide
the full URL to the list or library, otherwise PowerShell will import
the site if the URL is to the main site location. For brevity, most of
the options specified in the previous export steps exist for the import
command. Use the Get-help feature of PowerShell to see all options.
Exporting of lists and libraries was new to
SharePoint 2010. In SharePoint 2007, administrators could export and
import sites only, using STSADM. SharePoint 2010, and now 2013,
supports STSADM export/import, but adds the capability of list and
library export by providing the full URL to the list or library.
Export and Import Using STSADM
The following steps demonstrate export of a
site, list, or library using the STSADM command from a regular Windows
command prompt:
- Type the following text into the console, replacing the appropriate placeholders:
STSADM –o export –url <site/list/library url> -filename <filename> - To export a specific list or library, provide the full URL to the
list or library. Otherwise, PowerShell will export the site if the URL
is to the main site location.
- Include the –overwrite option to overwrite the file.
- Include the -haltonfatalerror or -haltonwarning options to stop the export process in the event of an error or warning.
- Specifying the -includeusersecurity
option will ensure that all permissions applied to exported sites,
lists, libraries, and contained items are included in the export file.
- The -versions option instructs PowerShell to include version information of items in the export file.
- Include the -nofilecompression option to turn off file compression; this makes for a faster export but larger files on disk.
- The -nologfile option prevents PowerShell from creating a log of the export (not recommended generally).
- The -usesqlsnapshot option is the familiar SQL snapshot option for deployments running on SQL Server Enterprise.
The following steps demonstrate using STSADM
to import a site, list, or library. Look back through the command
options previously listed for the export, as some also apply to the
import command. - Type the following text into the console, replacing the appropriate placeholders:
STSADM –o import –url <site/list/library url> -filename <filename> - To import a specific list or library, provide the full URL to the list or library.
Export Using Central Administration
In this section, I demonstrate how to use
Central Administration to export a site, list, or library. You may have
noticed that this section does not cover import via the Central
Administration web browser interface—this is because Central
Administration does not provide a mechanism for site, list, or library
import from a file. To import, use either STSADM or PowerShell options,
previously discussed.
- Open Central Administration.
- Click on the Backup and Restore heading link.
- Click the Export a Site or List link under the Granular Backup heading.
- Select the site collection and then the site and/or list (see Figure 2).
- Provide the file location and toggle options for security and versions.
- Click the Start Export button to begin the export.
|