共用方式為


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