Get-VaultFolder
Retrieves a specific folder from Vault.
Syntax
Get-VaultFolder [-Path] <String> [<CommonParameters>]
Get-VaultFolder [-FolderId] <Long> [<CommonParameters>]
Get-VaultFolder -Properties <Hashtable> [<CommonParameters>]
Parameters
Type |
Name |
Description |
Optional |
---|---|---|---|
String |
Path |
Path of the folder in Vault |
no |
Long |
FolderId |
Id of the folder |
no |
Hashtable |
Properties |
Search for a folder with matching properties |
no |
Return type
Folder ← on success
empty ← on failure
Remarks
The -Properties parameter allows to search for folders that match all the passed properties and their values (system properties and UDPs are supported).
In the passed Hashtable the keys represent the property names and the values represent the searched property values.
If multiple folders match the passed properties, only the first match will be returned.
When no folder matches the passed properties, empty is returned.
When no folder property exists in Vault for a passed property name, it is ignored in the search.
Folders that are missing searched properties (property not assigned), will be ignored.
Examples
Get a Folder via its Vault path to check if it exists:
$folder = Get-VaultFolder -Path '$/Designs'
if($folder) {
Write-Host 'The Vault folder does exist'
}else if(-not $folder){
Write-Host "The Vault folder doesn't exist"
}
Get a Folder via its Id:
$folder = Get-VaultFolder -FolderId 153
Get a Folder matching specific properties:
$folder = Get-VaultFolder -Properties @{
"Category Name" = "ProjectFolder";
"Name" = "Main Project";
"ProjectNumber" = 100; # UDP
}
Using the Vault API and Get-VaultFolder to retrieve a folder:
$myFlcProjectUrn = "" # FLC Project URN
$vaultFlcIntegrationAttributes = $vault.PropertyService.FindEntityAttributes('FLC.ITEM', 'Urn')
$vaultFlcFolderMapping = $vaultFlcIntegrationAttributes | Where-Object { $_.Val -eq $myFlcProjectUrn } | Select-Object -First 1
$folder = Get-VaultFolder -FolderId $vaultFlcFolderMapping.EntityId