Add-FLCAttachment
Adds an Attachment to an existing Item in Fusion 360 Manage.
Syntax
Add-FLCAttachment -Workspace <String> -ItemId <Long> -Path <FileInfo> [[-Title] <String>] [[-Description] <String>] [<CommonParameters>]
<#
PARAMETER
-Workspace
Required true
-ItemId
Required true
-Path
Required true
-Title
Required false
-Description
Required false
<CommonParameters>
This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>
Directly passing an Item object:
Add-FLCAttachment -InputObject <PSObject> -Path <FileInfo> [[-Title] <String>] [[-Description] <String>] [<CommonParameters>]
<#
PARAMETER
-InputObject
Required true
Accepts pipeline input: true
-Path
Required true
-Title
Required false
-Description
Required false
<CommonParameters>
This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>
Type |
Name |
Description |
---|---|---|
String |
Workspace |
The name of the workspace that contains the Item |
Long |
ItemId |
The ID of the Item for which the attachment should be added |
InputObject |
The Fusion 360 Manage Item for which the attachment should be added. |
|
Path |
The Path to the file which should be uploaded and attached to the item. |
|
String |
Title |
The title to use for the attachment. If no title is provided, the filename without extension will be used. |
String |
Description |
A description for the uploaded attachment |
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 360 Manage.
A list of the file types that can be viewed in Fusion 360 Manage 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 360 Manage 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..."
}