IBackupRestoreTreeFormatter.Object 方法

在当前节点的树格式的组件 (如服务器场、 Web 服务、 Web 应用程序或内容数据库) 的名称。

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

语法

声明
Function Object ( _
    obj As SPBackupRestoreObject, _
    depth As Integer _
) As String
用法
Dim instance As IBackupRestoreTreeFormatter
Dim obj As SPBackupRestoreObject
Dim depth As Integer
Dim returnValue As String

returnValue = instance.Object(obj, depth)
string Object(
    SPBackupRestoreObject obj,
    int depth
)

参数

  • depth
    类型:System.Int32

    在树中当前节点的深度。

返回值

类型:System.String
String 表示可能的格式和批注), SharePoint Foundation内容组件当前节点的名称。

备注

针对实施者的注释

使用obj。基本数据的表现为Name

请考虑使用depth作为如何得来的名称缩进的措施。

考虑将添加到每个名称指示器,确定它是否可以选择用于备份或还原。

示例

下面的示例显示了Object方法的实现。

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

另请参阅

引用

IBackupRestoreTreeFormatter 接口

IBackupRestoreTreeFormatter 成员

Microsoft.SharePoint.Administration.Backup 命名空间