Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Vault Pro 2018: Item Thumbnail update

o-fischer
Advocate

Vault Pro 2018: Item Thumbnail update

o-fischer
Advocate
Advocate

Hi,

     I tried to update Thumbnail property for an Item and i get an error 3933. Is it possible to update this property if it's a System property?

This is what i tried:

 

VDF.Vault.Currency.Properties.ThumbnailInfo thumbnailInfo = new VDF.Vault.Currency.Properties.ThumbnailInfo(VDF.Vault.Currency.Properties.ThumbnailInfo.ThumbnailType.Thumbnail, System.IO.File.ReadAllBytes(selectedFile));

PropDef[] AllProperties = m_serviceManager.PropertyService.GetPropertyDefinitionsByEntityClassId(VDF.Vault.Currency.Entities.EntityClassIds.Items);

PropDef thumbnailPropDef = AllProperties.FirstOrDefault(x => x.DispName == VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.ThumbnailSystem);

PropInst[] PartThumbnailPropInt = connection.WebServiceManager.PropertyService.GetProperties(VDF.Vault.Currency.Entities.EntityClassIds.Items, new long[] { part.Id }, new long[] { thumbnailPropDef.Id });

List<PropInstParam> propinstparams = new List<PropInstParam>()

{

new PropInstParam(){Val = thumbnailInfo.Image, PropDefId = thumbnailPropDef.Id }

 

};

var myPropInstParamArray = new PropInstParamArray() { Items = propinstparams.ToArray()};

List<long> editItemids = new List<long>();

try

{

Item[] editableItems = m_serviceManager.ItemService.EditItems(new long[] { part.RevId});

editItemids = editableItems.Select(x => x.Id).ToList();

long[] _masterIds = editableItems.Select(x => x.RevId).ToArray();

Item[] updatedItems = connection.WebServiceManager.ItemService.UpdateItemProperties(_masterIds, new PropInstParamArray[] { myPropInstParamArray });

connection.WebServiceManager.ItemService.UpdateAndCommitItems(updatedItems);

}

catch (Exception)

 

{

connection.WebServiceManager.ItemService.UndoEditItems(editItemids.ToArray());

}

 

Olivier.

 

 

0 Likes
Reply
Accepted solutions (1)
838 Views
1 Reply
Reply (1)

psaarloos
Collaborator
Collaborator
Accepted solution

Hi Olivier,

 

Does it fail on this line?

 

Item[] updatedItems = connection.WebServiceManager.ItemService.UpdateItemProperties(_masterIds, new PropInstParamArray[] { myPropInstParamArray });

 

If so, I think you're right. Because it's a system property it fails. I know you can create a UDP and define the type as 'Image' by using the API (not possible through UI). You could store your own thumbnail in there. Don't know if it solves your problem, but it might be good to know 🙂

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes