Compartilhar via


SPDatabaseSnapshot.Restore Method

Overwrites the database with the database snapshot, as long as the class representing the database implements IDatabaseSnapshotRestore, and then deletes all database snapshots.

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

Syntax

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

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

Exceptions

Exception Condition
NotSupportedException

The SPDatabase-derived class that represents the database does not implement IDatabaseSnapshotRestore

Exception

A call of the OnPreRestore() method throws an exception.

Remarks

To force an overwrite of a database with one of its database snapshots, even if the SPDatabase-derived class that represents the database does not implement IDatabaseSnapshotRestore (or it implements it but the OnPreRestore() method throws an exception), use the Restore(Boolean) overload of this method.

See Also

Reference

SPDatabaseSnapshot Class

SPDatabaseSnapshot Members

Restore Overload

Microsoft.SharePoint.Administration.Backup Namespace