SPBackupRestoreSettings.IndividualItem Property

Gets or sets the content component that is backed up or restored.

Namespace:  Microsoft.SharePoint.Administration.Backup
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

Public Property IndividualItem As String
    Get
    Set

Dim instance As SPBackupRestoreSettings
Dim value As String

value = instance.IndividualItem

instance.IndividualItem = value
public string IndividualItem { get; set; }

Property Value

Type: System.String
A String that represents the name of the farm or the content component the farm that is backed up or restored.

Remarks

For example, a Web application might be named "SharePoint - 80"; a content database might be named "WSS_Content_1234567890a2b4c6d8e0f2a4b6c8d0e2". The entire farm is named "Farm" in Windows SharePoint Services 3.0.

This property is used to identify, in the spbackup.log or sprestore.log file, the top component in the tree of components that is backed up or restored. It is the responsibility of the calling code to ensure that the log is accurate by passing IndividualItem as the second parameter of the FindItems() method. (See the code example below.)

A partial name will work provided there is only one possible match. For example, "WSS_Content" would be enough to identify a content database provided that there is only one whose name begins with "WSS_Content". If two parent components each have a child with exactly the same name and you want to backup (or restore) one of them, you can disambiguate by appending the parent name to the front of the child name with a backslash character in between; for example, "SharePoint - 80\WSS_Content". If an ambiguous name is passed to the FindItems() method, it will return a collection with more than one member. In that case calling code should prompt user to be more specific. (See the example code below.)

You can set this property to any of the following kinds of components:

  • The whole farm. (But when the whole farm is the [IndividualItem] of a restore operation, neither the configuration database of the farm nor the content database of the Central Administration application will be restored.)

  • Any content publishing web service, except the WSS_Administration web service that publishes the pages of the Windows SharePoint Services Central Administration application.

  • Any Web application within a content publishing web service, except the Central Administration Web application.

  • Any content database within a Web application. But the content database of the Central Administration Web application can only be the IndividualItem for a backup operation. You cannot restore the content of the Central Administration application. Backing it up may be useful to create a point-in-time record of the database so that it can be compared, as a troubleshooting step, with a later version using SQL Server tools.

  • Any Shared Service Provider that is included with an enhanced functionality product, such as Microsoft Office SharePoint Server 2007, that is installed on top of Windows SharePoint Services.

  • Any custom content component that implements IBackupRestore.

Note

The configuration database of the farm is included in a backup operation if the IndividualItem is the whole farm, but it cannot be the IndividualItem by itself. Even more importantly, it is not restored when the farm is the IndividualItem of a restore operation. You cannot restore the configuration database. Backing it up may be useful to create a point-in-time record of the database so that it can be compared, as a troubleshooting step, with a later version using SQL Server tools.

To see an itemization of the names of the components on your farm that can be the objects of backup operations, you can either run the command stsadm -o backup -showtree at the server command line or navigate to Operations > Perform a Backup in the Central Administration application.

To obtain, programmatically, the names of the components on your farm that can be the objects of backup operations, use FindItems.

Examples

The following example shows how to use the IndividualItem property in a backup application. For the full example and a detailed discussion of it, see How to: Programmatically Back Up Content.

static void Main(string[] args)
{
    // Identify the location for the backup storage.
    Console.Write("Enter full UNC path to the directory where the backup will be stored:");
    String backupLocation = Console.ReadLine();
    
    // Create the backup settings.
    SPBackupSettings settings = SPBackupRestoreSettings.GetBackupSettings(backupLocation, "Full");

    // Identify the content component to backup.
    Console.Write("Enter name of component to backup (default is whole farm):");
    settings.IndividualItem = Console.ReadLine();
    
    // Set optional operation parameters.
    settings.IsVerbose = true;
    settings.UpdateProgress = 10;
    settings.BackupThreads = 10;

    // Create the backup operation and return its ID.
    Guid backup = SPBackupRestoreConsole.CreateBackupRestore(settings);

    // Ensure that user has identified a valid and unique component.
    SPBackupRestoreObject node = EnsureUniqueValidComponentName(settings, ref backup);

    // Ensure that there is enough space.
    Boolean targetHasEnoughSpace = false;
    if (node != null)
    {
        targetHasEnoughSpace = EnsureEnoughDiskSpace(backupLocation, backup, node);
    }

    // If there is enough space, attempt to run the backup.
    if (targetHasEnoughSpace)
    {
        // Set the backup as the active job and run it.
        if (SPBackupRestoreConsole.SetActive(backup) == true)
        {
            if (SPBackupRestoreConsole.Run(backup, node) == false)
            {
                // Report "error" through your UI.
                String error = SPBackupRestoreConsole.Get(backup).FailureMessage;
                Console.WriteLine(error);
            }
        }
        else
        {
            // Report through your UI that another backup
            // or restore operation is underway. 
            Console.WriteLine("Another backup or restore operation is already underway. Try again when it ends.");
        }

        // Clean up the operation.
        SPBackupRestoreConsole.Remove(backup);

        Console.WriteLine("Backup attempt complete. Press Enter to continue.");
        Console.ReadLine();
    }
}// end Main

See Also

Reference

SPBackupRestoreSettings Class

SPBackupRestoreSettings Members

Microsoft.SharePoint.Administration.Backup Namespace