Save-FLCAttachment
Downloads the specified attachment from Fusion 360 Manage to a local directory.
Syntax
Save-FLCAttachment -Workspace <String> -ItemId <long> -AttachmentId <Long> -DownloadPath <String> [<CommonParameters>]
<#
PARAMETER
-Workspace
Required true
-ItemId
Required true
-AttachmentId
Required true
-DownloadPath
Required true
<CommonParameters>
This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>
Directly passing an Attachment object:
Save-FLCAttachment -InputObject <PSObject> -DownloadPath <String> [<CommonParameters>]
<#
PARAMETER
-InputObject
Required true
Accepts pipeline input: true
-DownloadPath
Required true
<CommonParameters>
This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>
Parameters
Type |
Name |
Description |
---|---|---|
String |
Workspace |
The name of the workspace that contains the item with the specified attachment. |
Long |
ItemId |
The ID of the item to which the specified attachment belongs. |
Long |
AttachmentId |
The ID of the attachment that will be downloaded. |
InputObject |
The Fusion 360 Manage Item whose associated Items are retrieved. |
|
DownloadPath |
The Path to a local directory where the attachment should be downloaded. If the destination directory does not exist, it will be created. |
Return type
FileInfo ← On success.
empty ← on failure. Exception/ErrorMessage can be accessed using $Error.
Remarks
The Cmdlet downloads the specified direct Attachment and returns its download location.
The passed -Workspace has to be configured properly and must allow viewing/downloading the according Attachments in the Attachments Tab.
Attachments that have the same file name will be downloaded with a suffix, for example “SampleFile (1).png” .
For attachments that have multiple versions, the latest version is downloaded.
Examples
To use the examples below a Fusion 360 Manage PLM demo Tenant is required:
Download a specific attachment of an Item in Fusion 360 Manage
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$item = (Get-FLCItems -Workspace 'Change Orders' -Filter 'ITEM_DETAILS:NUMBER="CO000016"')[0]
$attachments = $item | Get-FLCItemAssociations -Attachments
$attachments | Where-Object {$_.Title -eq "GT220 Change Proposal"} | Save-FLCAttachment -DownloadPath 'C:\Temp\MyPictures'
<#
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 02.07.2021 13:09 1344916 GT220 Change Proposal.png
#>
Download the related attachments of a header item that has BOM line items with attachments in its BOM in Fusion 360 Manage
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$bomRows = Get-FLCBOM -Workspace 'Items' -ItemId 7516
foreach($bomRow in $bomRows) {
$relatedAttachments = $bomRow | Get-FLCItemAssociations -Attachments
$relatedAttachments | Save-FLCAttachment -DownloadPath 'C:\Temp\Attachments'
}
Error handling, analyze why the attachment could not be downloaded to the specified directory, by using $Error
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$downloadedAttachment = Save-FLCAttachment -Workspace 'Tasks' -ItemId 7624 -AttachmentId 266 -DownloadPath '\\192.0.0.1\Some currently not available directory\'
if(-not $downloadedAttachment ){
$Error[0].Exception #Returns "The network path was not found."
}