Compartilhar via


SPBackupRestoreConsole.CreateBackupRestore Method (SPBackupRestoreSettings, Boolean)

Creates a backup or restore operation and assigns it an ID.

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

Syntax

'Declaration
Public Shared Function CreateBackupRestore ( _
    settings As SPBackupRestoreSettings, _
    showTree As Boolean _
) As Guid
'Usage
Dim settings As SPBackupRestoreSettings
Dim showTree As Boolean
Dim returnValue As Guid

returnValue = SPBackupRestoreConsole.CreateBackupRestore(settings, _
    showTree)
public static Guid CreateBackupRestore(
    SPBackupRestoreSettings settings,
    bool showTree
)

Parameters

  • showTree
    Type: System.Boolean

    true to indicate that the tree of components should be printed instead of an actual backup/restore operation; otherwise false.

Return Value

Type: System.Guid
A Guid that identifies the new backup or restore operation.

Exceptions

Exception Condition
ArgumentNullException

settings is a null reference (Nothing in Visual Basic).

SPException

The component is already scheduled for a backup or restore.

Remarks

The backup or restore operation is an SPBackupRestoreConsoleObject object. The Guid that is returned is the primary way that your code can refer to the operation when it calls the critical members of SPBackupRestoreConsole. For example, you use the Guid as a parameter to the SetActive, Run, and Remove methods.

If you want to get a direct reference to the SPBackupRestoreConsoleObject object, use Get.

The CreateBackupRestore method also creates a SPBackupRestoreHistoryObject object that has the same ID as the SPBackupRestoreConsoleObject object.

See Also

Reference

SPBackupRestoreConsole Class

SPBackupRestoreConsole Members

CreateBackupRestore Overload

Microsoft.SharePoint.Administration.Backup Namespace