次の方法で共有


IBackupRestore.OnPreRestore method

Provides restore preparation processing.

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

Syntax

'Declaration
Function OnPreRestore ( _
    sender As Object, _
    args As SPRestoreInformation _
) As Boolean
'Usage
Dim instance As IBackupRestore
Dim sender As Object
Dim args As SPRestoreInformation
Dim returnValue As Boolean

returnValue = instance.OnPreRestore(sender, _
    args)
bool OnPreRestore(
    Object sender,
    SPRestoreInformation args
)

Parameters

Return value

Type: System.Boolean
true if successful; otherwise, false.

Remarks

In most situations, a restoration operation requires no preparation and your implementation of OnPreRestore should just return true.

Some examples of things you might need to accomplish with your implementation:

  • If your content object's Name property has not be initialized, set it with the SPName parameter of args by using the GetParameter() method as shown in this example:

    this.Name = args.GetParameter(SPBackupRestoreObject.SPName);
    
    Me.Name = args.GetParameter(SPBackupRestoreObject.SPName)
    
  • If the content component represented by the IBackupRestore object is some kind of database, OnPreRestore can be used to specify settings information needed to connect with the database application.

  • If your implementation of OnPreRestore takes a significant portion of the total time for the backup operation, set args.CurrentProgess() to an appropriate value.

  • If you want end users to have the option of migrating the backed up content, your implementation of OnPreRestore must also initialize SPServer, SPName, and SPLocation to their current values. If you do not do this initialization, the Central Administration application will not present the end user with a UI in which he or she can enter a new server, component name, or location. In SharePoint Foundation, this UI is in the New Names section of the Restore from Backup - Step 4 of 4 page of the Central Administration application. (It is also necessary that CanRenameOnRestore be set to true.)

Important

Do not stop or pause a service or Web application in the OnPreRestore(Object, SPBackupInformation) method. See OnRestore(Object, SPBackupInformation) for why.

The OnPreRestore method will always run when the IBackupRestore object has been selected for restoration. If it returns false, neither the OnRestore nor the OnPostRestore methods will run.

See also

Reference

IBackupRestore interface

IBackupRestore members

Microsoft.SharePoint.Administration.Backup namespace