Get-VaultFileAssociations

Returns a collection of direct file relationships for the specified Vault file.

Syntax

1
Get-VaultFileAssociations -File <String> [-Attachments] [-Dependencies] [-Type FileAssociationType] [<CommonParameters>]

Parameters

Type

Name

Description

Default value

Optional

String

File

Full path to the Vault file

no

SwitchParameter

Attachments

Specifies that relationships of type Attachment will be returned

yes

SwitchParameter

Dependencies

Specifies that relationships of type Dependency will be returned

yes

FileAssociationType

Type

Specifies which kind and direction of associations should be retrieved

Children

yes

FileAssociationType

Name

Description

Children

Get all files used by the specified file

Drawings

Get only related design documents which use the specified file

Parents

Get all types of files which use the specified file

Return type

File[] ← on success
empty ← on failure

Remarks

The cmdlet returns all the files which can be linked in a parent/child or attachment relationsip to the specified Vault file.

When no -Dependencies and -Attachments parameter is specified, then both types of file relationships are provided.

By default Children are returned, in fact in their exact versions which were used when the most recent version of the file was uploaded.

Alternatively all the Parent files, or only Drawings, can be retrieved which use the specified file.
Their latest versions are returned, regardless of whether they are using older versions of the specified file.

Examples

Display all the direct Uses of the Pad Lock.iam in Console

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
$file = Get-VaultFile -Properties @{Name = "Pad Lock.iam"}

$allDirectChildAssociations = Get-VaultFileAssociations -File $file._FullPath -Type Children
$allDirectChildAssociations | Format-Table Name, Revision, 'State (Historical)'
<#
Name                    Revision State (Historical)
----                    -------- ------------------
Retainer.ipt            B        Work in Progress
Combo Assembly.iam      A        Work in Progress
Catch Assembly.iam      A        Released
Case Back.ipt
Case Inner.ipt          A        Work in Progress
Case Outer.ipt          A        Work in Progress
Catch Post.ipt          1        Work in Progress
Catch.ipt               1        Work in Progress
Combo Backing Plate.ipt A        Work in Progress
Dial.ipt                A        Work in Progress
Lock Shackle.ipt        A        Work in Progress
#>

Get the exact versions of used File Dependencies

$dependencies = Get-VaultFileAssociations -File '$/Libraries/Combo Plate iPart/Combo Plate Lower.ipt' -Dependencies

$dependencies | Format-List _Name, _HasParentRelationship, _VersionNumber, _LatestVersion
<#
_Name                  : Combo Plate iPart.ipt
_HasParentRelationship : True
_VersionNumber         : 1
_LatestVersion         : False
#>

Get only Design Visualization attachments of type PDF

$allAttachments = Get-VaultFileAssociations -File "$/Designs/Padlock/Assemblies/Combo Assembly.idw" -Attachments

$pdfAttachments = $allAttachments | Where-Object { $_._Classification -eq "Design Visualization" -and $_._Extension -eq "pdf"}

Display all the files where the Catch Assembly.iam is directly used

$allParentAssociations = Get-VaultFileAssociations -File '$/Designs/Padlock/Assemblies/Catch Assembly.iam' -Type Parents

$allParentAssociations | Format-Table _FolderPath, _Name, _Classification, _VersionNumber, _LatestVersion, IsCheckedOut
<#
_FolderPath                  _Name              _Classification     _VersionNumber _LatestVersion IsCheckedOut
-----------                  -----              ---------------     -------------- -------------- ------------
$/Designs/Padlock/Assemblies Pad Lock.iam       None                            16           True         True
$/Designs/Padlock/Assemblies Catch Assembly.idw Design Document                  5           True        False
$/Designs/Padlock/Assemblies Catch Assembly.ipn Design Presentation              3           True        False
#>

Get the associated Drawing which uses the specified model

$part = Get-VaultFile -Properties @{Name = "Case Back.ipt"}
if($part._HasDrawing) {
  $relatedDrawing = (Get-VaultFileAssociations -File $part._FullPath -Type Drawings)[0]
}

Get only Parent files which have a specific file attachement

$attachment = Get-VaultFile -Properties @{Name = "Spiral.xls"}

(Get-VaultFileAssociations -File $attachment._FullPath -Type Parents -Attachments) | Format-Table Name,_HasAttachments, _VisualizationAttachment
<#
Name                  _HasAttachments _VisualizationAttachment
----                  --------------- ------------------------
Fermat Spiral.ipt     True            None
Flexural Spiral.ipt   True            User
Hyperbolic Spiral.ipt True            System
#>