PartItem.getfileproperty("thumbnail", filepath) fails to upload to vault

I am trying to upload a thumbnail image to a part item (innovator.part.thumbnail)

The method for this is the setfileproperty method.

I have written a function to do this, but it failt to create a new file in the vault.  The other updates work fine and the part.thumbnail property does populate with some unknown GUID

Public Sub RegisterArasPart(strPartNumber As String _
 , strName As String _
 , strDescription As String _
 , strClassification As String _
 , strLegacyNumber As String _
 , strPDMDocumentID As String _
 , strImagePath As String)

 'Update an existing Aras Item and populate the thumbnail
 'Note: I ensured that the file specified is on the server (or available)

 Dim NewPartItem As Aras.IOM.Item = inn.newItem("part", "add")
 NewPartItem.setProperty("item_number", strPartNumber) ' & iDashNumber.ToString("00"))
 NewPartItem.setProperty("name", strName)
 NewPartItem.setProperty("description", strDescription)
 NewPartItem.setProperty("pdmdocumentid", strPDMDocumentID)
 NewPartItem.setProperty("classification", strClassification)
 NewPartItem.setProperty("_legacy_number", strLegacyNumber)
 NewPartItem.setFileProperty("thumbnail", strImagePath) 'This fails to upload the file given by the strImagePath.
 NewPartItem.apply()

 DisconnectFromAras() 'This is my function to disconnect

End Sub

  • Hi Kent,

    I am not sure if you can use "setFileProperty" for uploading thumbnails. Regular "file" properties just contain the id of the file. The thumbnail property works different. Take a look at an existing thumbnail property and check the property value. It´s something similar to "vault://12345". 

    How does your "strImagePath" look like? Does it contain the vaulted file already or is it a link to a local file on your pc? In this case you have to upload the file before you can set is at property. 

    Angela

  • Thank you for your reply.  The strImagePath variable = "C:\Users\kkeller\Pictures\111080-01.bmp"

    This file lives on the server, which is the local machine in my case right now (having failed using an unc path in a shared Aras environment, I attempted to eliminate possible problems by restricting to one box).

    I am aware that the file in the innovator.part.thumbnail field is something like "vault:///?fileId=D5612B10085449F5AD7B22155B106E43", if you select a file with the normal interface, and this is working; eliminating a file permission error.

    Looking at the innovator.file table, I found the file that I uploaded manually to another item.  Using the found ID, I then executed the following line:

    PartItem.setProperty("thumbnail", "vault:///?fileId=D5612B10085449F5AD7B22155B106E43")

    This worked.  So the problem is the actual uploading of the file to the vault, not the updating of the innovator.part.thumbnail field.

    As I stated, the innovator.part.thumbnail does get some unknown GUID, but no new entry appears in the innovator.file table.

    If I could find a function that simply vaults a file, I could do this in two steps.

    But, for now, I am stalled out.

  • Do you want to solve everything in c#, or would a js / c# combination work for you?

    This is an earlier question I had regarding the file picker. 

    https://community.aras.com/f/development/6621/how-to-add-restrictions-to-aras-vault-selectfile-file-picker

    Notice Chris´ sample for uploading file. I myself use a variant of this one to upload my local files and build items from them. 

    ---

    You liked this answer? Visit my Youtube channel!!!