Share via


SPBackupRestoreInformation.IsBackup property

Gets a value that specifies whether the operation is a backup or a restore.

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

Syntax

'Declaration
Public ReadOnly Property IsBackup As Boolean
    Get
'Usage
Dim instance As SPBackupRestoreInformation
Dim value As Boolean

value = instance.IsBackup
public bool IsBackup { get; }

Property value

Type: System.Boolean
true if the operation is a backup; otherwise, false, which means the operation is a restore.

Examples

The following sample shows the IsBackup property used in an implementation of the Object method.

public String Object(SPBackupRestoreObject obj, int depth)
{
    StringBuilder build = new StringBuilder();

    if (obj.CanBackup == false || obj.CanRestore == false)
    {
        build.Append("*");
    }
    
    if ((obj.Information.IsBackup &&
         !obj.IBackupRestore.CanSelectForBackup) 
        ||
        (!obj.Information.IsBackup &&
         !obj.IBackupRestore.CanSelectForRestore))
    {
        build.Append("[");
    }

    build.Append(obj.Name);

    if ((obj.Information.IsBackup &&
         !obj.IBackupRestore.CanSelectForBackup)
        ||
        (!obj.Information.IsBackup &&
         !obj.IBackupRestore.CanSelectForRestore))
    {
        build.Append("]");
    }

    build.Append("+*+*+");

    return build.ToString();
}
Public Function [Object] (ByVal obj As SPBackupRestoreObject, ByVal depth As Integer) As String
    Dim build As New StringBuilder()

    If obj.CanBackup = False OrElse obj.CanRestore = False Then
        build.Append("*")
    End If

    If (obj.Information.IsBackup AndAlso (Not obj.IBackupRestore.CanSelectForBackup)) OrElse ((Not obj.Information.IsBackup) AndAlso (Not obj.IBackupRestore.CanSelectForRestore)) Then
        build.Append("[")
    End If

    build.Append(obj.Name)

    If (obj.Information.IsBackup AndAlso (Not obj.IBackupRestore.CanSelectForBackup)) OrElse ((Not obj.Information.IsBackup) AndAlso (Not obj.IBackupRestore.CanSelectForRestore)) Then
        build.Append("]")
    End If

    build.Append("+*+*+")

    Return build.ToString()
End Function

See also

Reference

SPBackupRestoreInformation class

SPBackupRestoreInformation members

Microsoft.SharePoint.Administration.Backup namespace