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