Partilhar via


IBackupRestore.OnBackupComplete Method

Provides post backup processing.

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

Syntax

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

returnValue = instance.OnBackupComplete(sender, _
    args)
bool OnBackupComplete(
    Object sender,
    SPBackupInformation args
)

Parameters

  • sender
    Type: System.Object

    The object that calls OnBackupComplete.

Return Value

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

Remarks

At a minimum, your implementation should set CurrentProgess() to 100 percent and return true. This is typically all that is required.

In some cases, post backup actions are needed. For example, your implementation of OnBackupComplete could restart a Windows service that had to be stopped or paused for the backup operation.

The OnBackupComplete method will not run if OnBackup returns false.

Examples

The following shows the most common implementation of OnBackupComplete.

public Boolean OnBackupComplete(Object sender, SPBackupInformation args)
{
    if (args == null)
    {
        throw new ArgumentNullException("args");
    }
    args.CurrentProgress = 100;
    return true;
}
Public Function OnBackupComplete(ByVal sender As Object, ByVal args As SPBackupInformation) As Boolean
    If args Is Nothing Then
        Throw New ArgumentNullException("args")
    End If
    args.CurrentProgress = 100
    Return True
End Function

See Also

Reference

IBackupRestore Interface

IBackupRestore Members

Microsoft.SharePoint.Administration.Backup Namespace