Get-VaultItemAssociations or Get-VaultFileAssociations returns files with empty properties

Issue

The returned files of the Get-VaultFileAssociations or the Get-VaultItemAssociations Cmdlets are missing some properties or return an incorrect file version.

Cause

Both Cmdlets return the exact version of the associated files, which is the file version that is associated to the file or item. The exact version is not necessarily the latest version.

Solutions

There are 2 solutions to this issue:

Solution 1

For item associations you can right click on the item and click on "Update"

For files you'll have to open them using the corresponding application to update the associations

Solution 2

Use the Get-VaultFile Cmdlet again for the files that are returned with the Get-VaultFileAssociations or the Get-VaultItemAssociations Cmdlets in order to get the latest version of the file.

Example for item associations:

$item = Get-VaultItem -Number 100001
$associatiedFiles = Get-VaultItemAssociations -Number $item._Number
$filesLatestVersion = @()
foreach ($associatiedFile in $associatiedFiles) {
    $filesLatestVersion += Get-VaultFile -File $associatiedFile._FullPath
}

Example for file associations:

$file = Get-VaultFile -File '$/Designs/Inventor/Drawing1.idw'
$associatiedFiles = Get-VaultFileAssociations -File $file._FullPath
$filesLatestVersion = @()
foreach ($associatiedFile in $associatiedFiles) {
    $filesLatestVersion += Get-VaultFile -File $associatiedFile._FullPath
}

See Also