閱讀英文

共用方式為


IBackupRestoreTreeFormatter.Object method

在目前節點樹狀目錄的格式 (例如伺服器陣列、 Web 服務、 Web 應用程式或內容資料庫) 元件名稱。

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

Syntax

'宣告
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
    Type: System.Int32

    在樹狀目錄中的目前節點深度。

傳回值

Type: System.String
String 代表可能是格式化以及加註解, SharePoint Foundation內容元件的目前節點的名稱。

備註

Notes to implementers

使用obj。基本的資料呈現為Name

請考慮使用depth為縮排名稱的量值。

考慮新增至每個名稱標記的是否為選取的備份或還原。

Examples

下列範例顯示實作的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 interface

IBackupRestoreTreeFormatter members

Microsoft.SharePoint.Administration.Backup namespace