Start a new topic

powerVault 20.0.1

I have installed powerVault 20.0.1.  I am using it to connect to Vault Professional 2019 and search for a group of files. 

Import-Module powerVault

Open-VaultConnection -Vault vaultName -Server serverName -User userAccount -Password password

 This works without a problem.


But because the 'Get-VaultFiles' commandlet does not have a flag for "Recursive", I am getting a list of Folders to search with the normal Vault API.  

$parentFolder = $vault.DocumentService.GetFolderByPath(parentFolder)

$subFolders = $vault.DocumentService.GetFoldersByParentId($parentFolder.Id, 'True')

 This also works with no problem.  The end result is an array of folders within the $subFolders variable.


Next I use a foreach loop to go through each sub-folder and use the 'Get-VaultFiles' commandlet, passing in the fullname from the current object of the foreach loop.

  

foreach($folder in $subFolders){
        $idwFilesinFolder = Get-VaultFiles -Folder $folder.FullName.ToString() -Properties @{"File Extension" = "IDW"; "State" = "Released"; "Hidden"= 0 }
}

 When I use the variable name of the current loop itteration, it does not actually parse the variable but instead just searches the entire Vault.  When searching through the Vault client, I get 16k results.  When I use the commandlet, I am getting 63k results which matches if I search from the top level of Project Explorer.


This is being observed with Fiddler and looking at the TotalHits value of the request.

1 Comment

Hello Kevin,

Thank you for reaching out to us. Unfortunately at the moment the -Properties argument is ignored when -Folder is used in the Get-VaultFiles cmdlet. This means at the moment all files are returned. Here is a code snipped that i wrote to get only the needed files:

$idwFilesinFolder = @()
foreach($folder in $subFolders) {
        $idwFilesinFolder += (Get-VaultFiles -Folder $folder.FullName) | Where-Object {$_._Extension -eq "idw" -and $_.State -eq "Released" -and $_.Hidden -eq "False"}
}


Kind regards,

Manuel Cassan


Please mark this topic as solved if all your questions were answered.

Login or Signup to post a comment