SharePoint recovery on an item-level basis

SharePoint recovery of data can be complicated, but in this tip, Brien Posey shows how to perform item-level data recovery.

SharePoint recovery of data can be a surprisingly complicated process. Microsoft makes it relatively easy to restore a site collection, but if you need to restore such lower-level objects as individual sites, applications, lists or libraries, the recovery process becomes much less intuitive. This article provides an overview of the process of performing item-level recovery of SharePoint data.

Performing item-level recovery using the built-in tools requires the use of a disaster recovery "farm," which acts as a repository for the data that is being restored. This holds true whether you want to recover a site, a list, a library or even a document.

Once you have created it, you restore your SharePoint backup to the disaster recovery farm. The backup does not get restored to the production farm because the goal is to recover a specific piece of data. Restoring a backup to the production farm would overwrite data that shouldn't be replaced.

Exporting an item

Once your backup has been restored to the disaster recovery farm, the next step is to export the data you want to restore so you can import it into your production environment. The data export process can be performed only through the SharePoint Management Shell. To do this, you have to use the Export-SPWeb cmdlet command. This cmdlet's syntax looks like this:

Export-SPWeb –Identity <site URL> -Path <the path and filename of the file that will contain the exported data> [-ItemURL <the URL of the site, list, or library that you want to export>] [-Include user security] [-Includeversions] [-NoFileCompression] [-GradualDelete] [-Verbose]

The actual set of switches you will use varies based on how SharePoint is configured, but the command might look something like this:

Export-SPWeb –Identity http://mysharepointserver/sites/mysite -Path C:\data -ItemURL http://mysharepointserver/sites/mysite/library.aspx

By far, the most important of the optional parameters is ItemURL, which lets you specify an individual site, list or library. Also important is the IncludeUserSecurityswitch, which preserves the security attributes of the item you are exporting.

Another switch you need to know about is the IncludeVersions switch, which lets you specify which version or versions of the item to recover. If you omit this switch, the LastMajor version will be exported by default, but you do have other options, including CurrentVersion, LastmajorandMinor or All.

Importing an item

The last step in the item-level recovery process is to import the item into your SharePoint production farm. The exact technique you will use varies depending on the type of item you are importing. Assuming that you are importing a site, list or library, you will have to open the SharePoint Management Shell, then use the Import-SPWeb cmdlet. This cmdlet's syntax looks like this:

Import-SPWeb –Identity <SharePoint site URL> -Path <the path and filename of the file containing the data that you want to import> [-Force] [-NoFileCompression] [-Verbose]

Again, the actual command you will use varies from one organization to another, but might look something like this:

Import-SPWeb –Identity http://mysharepointserver/sites/mysite -Path C:\data\mydata -NoFileCompression

As you can see, the cmdlet's syntax is fairly straightforward, but you should know a couple of things before you use it. First, if you are going to be importing an entire site, that site must have a template that matches the template of the site that is specified by the Identity parameter. This shouldn't normally be a problem if you are performing an import as a way of returning an existing site to a previous state, but it could become a problem if you try to use this method to import a site that is completely foreign to the SharePoint environment.

The other thing you should be aware of is that Microsoft recommends using the NoFileCompression switch when you perform the import. As the name implies, this switch prevents SharePoint from trying to compress the data during the import process. Turning off compression reduces overall resource consumption. By some estimates, avoiding the use of compression can reduce CPU overhead by as much as 30%.


As you can see, SharePoint 2010 does include a mechanism for performing item-level recoveries. Although the process is tedious and often time-consuming, it is Microsoft's preferred method for performing item-level recovery using native SharePoint tools.

About the author:
Brien M. Posey, MCSE, has received Microsoft's MVP award for Exchange Server, Windows Server and Internet Information Server (IIS). Brien has served as CIO for a nationwide chain of hospitals and has been responsible for the Department of Information Management at Fort Knox. You can visit Brien's personal website at www.brienposey.com.

Dig Deeper on Backup and recovery software