Compartilhar via


IBackupRestoreTreeFormatter.Object Method

Formats the name of the component (such as farm, Web service, Web application, or content database) at the current node of the tree.

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

Syntax

'Declaration
Function Object ( _
    obj As SPBackupRestoreObject, _
    depth As Integer _
) As String
'Usage
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
)

Parameters

  • depth
    Type: System.Int32

    The depth in the tree of the current node.

Return Value

Type: System.String
A String that represents the name, possibly formatted and annotated, of the SharePoint Foundation content component for the current node.

Remarks

Notes to Implementers

Use obj.Name as the basic data to be presented.

Consider using depth as the measure of how far to indent the name.

Consider adding to each name an indicator of whether it can be selected for backup or restore.

Examples

The following sample shows 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();
}
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

See Also

Reference

IBackupRestoreTreeFormatter Interface

IBackupRestoreTreeFormatter Members

Microsoft.SharePoint.Administration.Backup Namespace