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>]
Save-FLCAttachment -InputObject <PSObject> -DownloadPath <String> [<CommonParameters>]

Parameters

Type

Name

Description

Optional

String

Workspace

The name of the workspace that contains the item with the specified attachment.

no (optional when InputObject is used)

Long

ItemId

The ID of the item to which the specified attachment belongs.

no (optional when InputObject is used)

Long

AttachmentId

The ID of the attachment that will be downloaded.

no (optional when InputObject is used)

Item

InputObject

The Fusion 360 Manage Item whose associated Items are retrieved. The argument accepts pipeline input.

no (optional when Workspace, ItemId and AttachmentId are used)

DirectoryInfo

DownloadPath

The Path to a local directory where the attachment should be downloaded. If the destination directory does not exist, it will be created.

no

Return type

FileInfo ← On success.
empty ← on failure. Exception/ErrorMessage can be accessed using $Error.

Remarks

The commandlet 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 and BOMs' -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."
}