IBackupRestore.CanSelectForBackup property
Gets or sets a value that indicates whether the content component that is represented by the IBackupRestore object can be selected for backup, independently of its parent component, 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 CanSelectForBackup As Boolean
Get
Set
'Usage
Dim instance As IBackupRestore
Dim value As Boolean
value = instance.CanSelectForBackup
instance.CanSelectForBackup = value
bool CanSelectForBackup { get; set; }
Property value
Type: System.Boolean
true if the object can be selected for backup; otherwise, false.
Remarks
If users should never be able to backup objects of your custom component class independently of a backup of the parent object, the get accessor should return false. If users should be able to select any object of your class for independent backup, the get accessor should return true. In either case, the set accessor should be an empty pair of braces "{ }". If users should be able to independently backup some objects of your type at some times, but should not be prevented from independently backing up some of these objects in certain circumstances, implement the property as a wrapper around a private Boolean field.
The configuration database of the farm is an example of a component that cannot be individually selected for backup.
Examples
The following sample shows the CanSelectForBackup 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