SPBackupRestoreObject.CanRestore Property
Gets or sets a value that indicates whether the component represented by the IBackupRestore property has been selected for restoration.
Namespace: Microsoft.SharePoint.Administration.Backup
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Property CanRestore As Boolean
Get
Set
'Usage
Dim instance As SPBackupRestoreObject
Dim value As Boolean
value = instance.CanRestore
instance.CanRestore = value
public bool CanRestore { get; set; }
Property Value
Type: System.Boolean
true if the component should be restored; otherwise, false.
Remarks
This property is not an indicator of whether the component is of a type that can be restored. Instead, it is an indicator of whether the IBackupRestore property is a null reference (Nothing in Visual Basic). If it is a null reference (Nothing in Visual Basic), then the component has not been selected for restoration.
Examples
The following sample shows the CanRestore 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