共用方式為


SPBackupRestoreObject.CanBackup property

取得或設定一個值,指出是否已選取IBackupRestore屬性所代表的元件備份。

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

Syntax

'宣告
Public Property CanBackup As Boolean
    Get
    Set
'用途
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如果元件應該備份 ;否則,請false。

備註

此屬性的元件是否可以備份類型的指標。但是,它是IBackupRestore屬性是否a null reference (Nothing in Visual Basic)指示器。如果是a null reference (Nothing in Visual Basic),然後元件尚未選取備份。

Examples

下列範例顯示使用中實作的Object方法CanBackup屬性。

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

請參閱

參照

SPBackupRestoreObject class

SPBackupRestoreObject members

Microsoft.SharePoint.Administration.Backup namespace