Share via


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

Property CanSelectForBackup As Boolean
    Get
    Set

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();
}

See Also

Reference

IBackupRestore Interface

IBackupRestore Members

Microsoft.SharePoint.Administration.Backup Namespace