Share via


SPDatabaseSnapshot.Restore method (Boolean)

Overwrites the database with the database snapshot and then deletes all database snapshots, optionally ignoring whether the database class implements IDatabaseSnapshotRestore.

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

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Sub Restore ( _
    force As Boolean _
)
'Usage
Dim instance As SPDatabaseSnapshot
Dim force As Boolean

instance.Restore(force)
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public void Restore(
    bool force
)

Parameters

  • force
    Type: System.Boolean

    If true the database snapshot is restored to the live database even if the database class does not implement the IDatabaseSnapshotRestore interface. If false, the database snapshot will only be restored to the live database if the database class implements the IDatabaseSnapshotRestore interface.

Exceptions

Exception Condition
NotSupportedException

force is false, and the SPDatabase-derived class that represents the database does not implement IDatabaseSnapshotRestore

Exception

force is false, and a call of the OnPreRestore() method throws an exception.

See also

Reference

SPDatabaseSnapshot class

SPDatabaseSnapshot members

Restore overload

Microsoft.SharePoint.Administration.Backup namespace