Description
Sometimes the Get-FLCItems cmdlet returns no results, even though the requested items exist in Fusion360. This will usually cause an Add-FLCItem to be run instead of an Update-FLCItem. Depending on the configuration in Fusion either duplicate items will be created or nothing will be transferred at all.
Cause
This happens due to a bug in the Fusion360 API.
Solution
To get around this make sure to mark the key property as Unique
This will cause fusion to return a error message you can use to check if that issue happened on the client.
$flcItem = Add-FLCItem -Workspace $workspace.Name -Properties $Properties -ErrorVariable AddItemError
if ($AddItemError -and $AddItemError[0].Exception -like '*cannot have duplicates*') {
# There is a bug in the Fusion search API that sometimes returns no items. To ensure items are updated properly when this happens the number must be marked as unique in Fusion
Write-Host "Add-FLCItem failed: $($AddItemError[0].Exception)"
Write-Host "Update item $($Entity."$($workflow.VaultUnique)")..."
$flcItem = Update-FLCItem -Workspace $flcItem.Workspace -ItemId $flcItsem.Id -Properties $Properties
}