SPCFolder.PathEx

This property is read only.

Syntax Parameters Return Value
ReadOnly Property SPCFolder.PathEx( _
    IncludeRoot As Boolean, _
    UseSlashAsSeparator As Boolean) As String
  • IncludeRoot [in]

Type: Boolean

  • UseSlashAsSeparator [in]

Type: Boolean

String

SVB Example

Searching for an item by name recursively:

Sub Main

    Dim oOM As New ObjectManager
    'Reconnect into Enterprise
    oOM.Reconnect Application

    Dim itemNameToSearchFor As String
    itemNameToSearchFor = "BREAD Charts"

    'Search the entire "Statistica Enterprise" folder structure for the first item
    'named "BREAD Charts" and report information about it.
    Dim fullPath As String
    Dim theObject
    Set theObject = FindItemInEnterpriseFolder(oOM, oOM.RootFolder, itemNameToSearchFor, fullPath)
    If TypeName(theObject) <> "Empty" Then
        Dim rpt As New Report
        rpt.SelectionText ="""" & itemNameToSearchFor & """ found." & vbCrLf & _
            "Object type: " & TypeName(theObject) & "." & vbCrLf & _
            "Location: " & fullPath
        rpt.Visible = True
    Else
        MsgBox "Unable to find """ & itemNameToSearchFor & """.", vbExclamation
    End If

    oOM.Disconnect

End Sub

'Searches for an item by name within the specified folder. Note that this search will be recursive,
'meaning that subfolders will also be searched. Also note that it will return the first item
'with the specified name that is encountered.
Function FindItemInEnterpriseFolder(ByVal oOM As ObjectManager, ByVal theFolder As SPCFolder, ByVal ItemName As String, ByRef fullPath As String) As Variant

    Dim theObject
    'Note that SPCFolder.Find only searches within itself,
    'it will NOT recurse through its subfolders.
    'Also, note that the "1" for the second parameter will make the search case INsensitive.
    Set theObject = theFolder.Find(ItemName, 1)
    'If item was found as a direct child in this folder, then return it.
    If TypeName(theObject) <> "Empty" Then
        fullPath = theFolder.PathEx(True, True)
        Set FindItemInEnterpriseFolder = theObject
        Exit Function
    'Otherwise, we will need to recurse through any subfolders.
    Else
        'Get a list of subfolders in this folder
        Dim subFolders
        Set subFolders = theFolder.List(swcFolder)
        Dim i As Long
        'Iterate through the subfolders and return if we find an item by specified name.
        For i = LBound(subFolders) To UBound(subFolders)
            Set theObject = FindItemInEnterpriseFolder(oOM, subFolders(i), ItemName, fullPath)
            If TypeName(theObject) <> "Empty" Then
                Set FindItemInEnterpriseFolder = theObject
                Exit Function
            End If
        Next
    End If

End Function