Save-VaultFile
Downloads a file from Vault to a local directory.
Syntax
Save-VaultFile -File <String> [-DownloadDirectory <String>] [-Version <VersionSelector>] [-ExcludeChildren] [-NoRecursiveChildren] [-NotOverride] [-IncludeAttachments] [-IncludeHiddenEntities] [-IncludeParents] [-RecursiveParents][-IncludeRelatedDocumentation] [<CommonParameters>]
Parameters
Type  | 
Name  | 
Description  | 
Default value  | 
Optional  | 
|
|---|---|---|---|---|---|
String  | 
File  | 
VAult Path to the file, which should be downloaded  | 
no  | 
||
String  | 
DownloadDirectory  | 
Absolute Path to a local directory. If NOT set, it will download the file to the Vault workspace.  | 
yes  | 
||
Version  | 
Version of the related files to be downloaded.  | 
Latest  | 
yes  | 
||
SwitchParameter  | 
ExcludeChildren  | 
Children of the source file will be excluded  | 
yes  | 
||
SwitchParameter  | 
NoRecursiveChildren  | 
Only the first level of children will be included  | 
yes  | 
||
SwitchParameter  | 
ExcludeLibraryContents  | 
Entities that are a part of a Vault Library will be excluded  | 
yes  | 
||
SwitchParameter  | 
NotOverride  | 
Folder/Files will not be overwritten, if they already exists  | 
yes  | 
||
SwitchParameter  | 
IncludeAttachments  | 
Attachments of the file will be included  | 
yes  | 
||
SwitchParameter  | 
IncludeHiddenEntities  | 
Hidden entities will be included  | 
yes  | 
||
SwitchParameter  | 
IncludeParents  | 
Parents of the source file will be included  | 
yes  | 
||
SwitchParameter  | 
RecursiveParents  | 
Parents will be included recursively  | 
yes  | 
||
SwitchParameter  | 
IncludeRelatedDocumentation  | 
The related documentation of the source file will be included.  | 
yes  | 
Return type
File[] ← on success
empty ← on failure. Exception/ErrorMessage can be accessed using $Error.
Remarks
The cmdlet downloads a file from the Vault Server to a local directory.
The result of the cmdlet contains a list of all the downloaded files.
Each of those files have an additional property ‘LocalPath’ containing the full path (including the file name) of the downloaded file.
VersionSelector
Name  | 
Description  | 
|---|---|
Lates  | 
Gathers the actual version for the relationship  | 
Actual  | 
Gathers the latest version  | 
Revision  | 
Gathers the appropriate version that represents the revision for the relationship  | 
Examples
Download a File
$result = Save-VaultFile -File "$/Designs/Sample/Not.iam" -DownloadDirectory "C:\temp\Vault\Sample\"
$result[0].LocalPath #Returns C:\temp\Vault\Sample\Not.iam
Download a File to the vault workspace including related documentation files
$result = Save-VaultFile -File "$/Designs/Sample/Not.iam" -IncludeRelatedDocumentation
Error handling, analyze why file could not be downloaded using $Error
$file = Save-VaultFile -File '$/Restriced/Reatiner.idw' -DownloadDirectory "C:\Temp\Test\Download"
if(-not $file){
    $Error[0].Exception #Returns: "You don't have permission to download the file. Please check the file's permissions in the Details dialog under the Security tab."
}