Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

getting Vault thumbnails

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
lornemartin
1019 Views, 4 Replies

getting Vault thumbnails

I am trying to figure out how to access a thumbnail of a Vault file.  I want to use this code from Doug Redmond, but what I need to know is how to get the 'Document.PropInst propInst' value to pass to the function.  I have a 'VDF.Vault.Currency.Entities.FileIteration' object in my code that is holding the file whose thumbnail I want to access, but how do connect the two together?

 

4 REPLIES 4
Message 2 of 5
Redmond.D
in reply to: lornemartin

From your Connection object, try calling PropertyManager.GetPropertyValue.  I think this will give you the byte array for the thumbnail.

Use PropertyManager.GetPropertyDefinitions to locate the thumbnail PropertyDefinition object.

 

Also, the link you posted is to the old thumbnail algorithm.  For Vault 2012 and higher, you should use the new thumbnail algorithm.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 3 of 5
lornemartin
in reply to: lornemartin

ok, thanks for that info, does this look close to right? I'm also having trouble setting up the propertyValueSettings value. Do you have any sample code at all?  

   Thanks a lot for your help.

 

public void getThumbNail(VDF.Vault.Currency.Entities.FileIteration file)
        {
            VDF.Vault.Currency.Properties.PropertyDefinitionDictionary propDict = vConnection.PropertyManager.GetPropertyDefinitions("FILE", VDF.Vault.Currency.Entities.EntityCategory.EmptyCategory, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll);
            
            VDF.Vault.Currency.Properties.PropertyValueSettings propSettings = new VDF.Vault.Currency.Properties.PropertyValueSettings();
            VDF.Vault.Currency.Properties.PropertyDefinition propDefinition = new VDF.Vault.Currency.Properties.PropertyDefinition();
            
            propDefinition = propDict.SingleOrDefault(x => x.Key == "Thumbnail").Value;
            //propSettings = ????
            vConnection.PropertyManager.GetPropertyValue(file,propDefinition,propSettings);

 

Message 4 of 5
Redmond.D
in reply to: lornemartin

You can pass in null for the settings when calling GetPropertyValue.  It will return a ThumbnailInfo object, which has the byte array in it.  See sample code below.

 

PropertyDefinition thumbnailPropDef = m_conn.PropertyManager.GetPropertyDefinitionBySystemName("Thumbnail");

ThumbnailInfo thumbnailInfo = m_conn.PropertyManager.GetPropertyValue(fileIter, thumbnailPropDef, null) as ThumbnailInfo;

byte [] thumbnailBytes = thumbnailInfo.Image;



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 5 of 5
lornemartin
in reply to: lornemartin

Thanks, I got it now.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report