This is the code I have which does not work. I think I'm close. What I would like it to do is get a list of files from the selected folder and all sub folders for the vault project folder that the user has selected.
Private Sub Proc_FillGrid()
Dim lstrSelSys As String
lstrSelSys = "$/" & cboSysList.Text
Dim searchFolder As VaultClientOperationsLib.VaultClientFolder = gobjClientDev.Repository.Root.FindFolderRecursive(lstrSelSys)
Dim ReturnArray As ArrayList = New ArrayList() ' = VaultClientOperationsLib.VaultClientFolder(searchFolder)
RecursivelySearchForFileName(searchFolder, "", ReturnArray)
End Sub
Private Sub RecursivelySearchForFileName(ByVal Folder As VaultClientOperationsLib.VaultClientFolder, ByVal filename As String, ByVal Arraylist As ArrayList)
Dim SubFolder As VaultClientOperationsLib.VaultClientFolder
Dim SubFile As VaultClientOperationsLib.VaultClientFile
Dim ReturnArray As ArrayList = New ArrayList()
If Folder.Files Is Nothing Then
For Each SubFile In Folder.Files
If filename = "" Then
ReturnArray.Add(SubFile)
Else
If SubFile.Name = filename Then
ReturnArray.Add(SubFile)
Exit For
End If
End If
Next
End If
If Folder.Files Is Nothing Then
For Each SubFile In Folder.Files
RecursivelySearchForFileName(SubFolder, filename, ReturnArray)
Next
End If
End Sub
Thank you
Vault API - Get folders and files
Moderator: SourceGear
I think that the only thing that is not right is your test for Folders and Files against Nothing
You have
But you need to have
Same goes for Folder.Folders.
You have
Code: Select all
If Folder.Files Is Nothing Then
Code: Select all
If Not Folder.Files Is Nothing Then
Same goes for Folder.Folders.