Add-FLCAttachment

Adds an Attachment to an existing Item in Fusion Lifecycle.

Syntax

Add-FLCAttachment -Workspace <String> -ItemId <Long> -Path <FileInfo> [[-Title] <String>] [[-Description] <String>] [<CommonParameters>]
Add-FLCAttachment -InputObject <PSObject> -Path <FileInfo> [[-Title] <String>] [[-Description] <String>] [<CommonParameters>]

Type

Name

Description

Optional

String

Workspace

The name of the workspace that contains the Item

no (optional when InputObject is used)

Long

ItemId

The ID of the Item for which the attachment should be added

no (optional when InputObject is used)

Item

InputObject

The Fusion Lifecycle Item for which the attachment should be added. The argument accepts pipeline input

no (optional when Workspace and ItemId are used)

FileInfo

Path

The Path to the file which should be uploaded and attached to the item.

no

String

Title

The title to use for the attachment. If no title is provided, the filename without extension will be used.

yes

String

Description

A description for the uploaded attachment

yes

Return type

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

Remarks

The cmdlet supports passing all versions of an item.
This means that for a revision-controlled workspace, an attachment can be added not only to working versions but also to the latest versions of an item.

The -Path arguments accepts all file types to be uploaded as attachment although only specific file types can be viewed with the Viewer in Fusion Lifecycle.
A list of the file types that can be viewed in Fusion Lifecycle can be found here.

When an attachment with the same Title already exists on the item a new version of the attachment is added.
Optionally with the -Title argument you can upload the same attachment using a different title.

Examples

To use the examples below a Fusion Lifecycle PLM demo Tenant is required:

Add an Attachment to an Item

Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'

$attachment = Add-FLCAttachment -Workspace 'Products' -ItemId 8684 -Path 'C:\Temp\Injection Molding Machine.dwf'

Add an Attachment using a specific title

Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'

$item = (Get-FLCItems -Workspace 'Documents' -Filter '"Final Assembly Installation"')[0]

$item | Add-FLCAttachment -Title 'Instructions' -Path '.\Documents\C300NO678S.pdf' -Description 'Documentation for Installation'

<#
Id          : 470
ItemId      : 8644
Workspace   : Documents
Title       : Instructions
FileName    : C300NO678S.pdf
Folder      :
Description : Documentation for Installation
Size        : 225659
Version     : 1
#>

Error handling, analyze why adding attachment failed using $Error

Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'

$attachment = Add-FLCAttachment -Workspace 'Suppliers' -ItemId 5839 -Path 'C:\Temp\Picture.png'

if(-not $attachment){
   $Error[0].Exception #Returns "FORBIDDEN: User ****: access ADD_ATTACHMENTS denied..."
}