IBackupRestore.CanSelectForRestore property

Gets or sets a value that indicates whether the content component that is represented by the IBackupRestore object can be selected for restoration in the Central Administration user interface or some other UI.

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

Syntax

'Declaration
Property CanSelectForRestore As Boolean
    Get
    Set
'Usage
Dim instance As IBackupRestore
Dim value As Boolean

value = instance.CanSelectForRestore

instance.CanSelectForRestore = value
bool CanSelectForRestore { get; set; }

Property value

Type: System.Boolean
true if the object can be selected for restoration; otherwise, false.

Remarks

If users should never be able to restore objects of your custom component class independently of a restoration of the parent object, the get accessor should return false. If users should be able to select any object of your class for independent restoration, the get accessor should return true. In either case, the set accessor should be an empty pair of braces "{ }". In most other cases, implement the property as a wrapper around a private Boolean field.

The content database of the Central Administration application is an example of a component that cannot be individually selected for restoration.

Examples

The following sample shows the CanSelectForRestore 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

IBackupRestore interface

IBackupRestore members

Microsoft.SharePoint.Administration.Backup namespace