SPBackupRestoreObject.CanBackup 属性

获取或设置一个值,该值指示是否已选择由IBackupRestore属性表示该组件进行备份。

命名空间:  Microsoft.SharePoint.Administration.Backup
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
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; }

属性值

类型:System.Boolean
true如果该组件应进行备份 ;否则为false。

备注

此属性指示组件是否可以备份的类型。相反,它是IBackupRestore属性是否空引用(无 在 Visual Basic 中)的指示器。如果它是空引用(无 在 Visual Basic 中),然后该组件尚未选择备份。

示例

下面的示例演示了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 类

SPBackupRestoreObject 成员

Microsoft.SharePoint.Administration.Backup 命名空间