Vault Category

Vault Category

f_calebh
Advocate Advocate
613 Views
5 Replies
Message 1 of 6

Vault Category

f_calebh
Advocate
Advocate

Is it possible to get the Vault Category Name for a file? I'm writing a code that I want to set up with an event trigger, but I only want the code to run for files of a specific Vault Category. 

 

I've found how to get the Lifecycle State online, but I can't figure out how to access the Vault File Category.

https://adndevblog.typepad.com/manufacturing/2019/04/connecting-vault-and-accessing-vault-file-statu...

 

 

 

 

 

0 Likes
Accepted solutions (1)
614 Views
5 Replies
Replies (5)
Message 2 of 6

g.georgiades
Advocate
Advocate

@f_calebhIt is basically the same thing as listed in the link you provided.

 

Simply replace

Dim lifeCycleInfo As VDF.Vault.Currency.Entities.FileLifecycleInfo = mFileIt.LifecycleInfo
Messagebox.Show(lifeCycleInfo.Statename)

 

With

Dim categoryInfo As VDF.Vault.Currency.Entities.EntityCategory = mFileIt.Category
Messagebox.Show(categoryInfo.Name)

 

You can find the few readily available properties in the FileIteration Documentation found from extracting the chm help document from "C:\Program Files\Autodesk\Vault Client 2025\SDK\Setup.exe"

 

Accessing system or user properties that are not directly part of the FileIteration object requires a bit more effort.

0 Likes
Message 3 of 6

f_calebh
Advocate
Advocate

That's what I assumed, but I get an error:

 

f_calebh_0-1722277717943.png

 

 

Dim mVltCon As VDF.Vault.Currency.Connections.Connection
mVltCon = VB.ConnectionManager.Instance.Connection
 
If  mVltCon Is Nothing Then
     MessageBox.Show("Not Logged In to Vault! - Login first and repeat executing this rule.")
     Exit Sub
End If

Dim VaultPath As String = ThisDoc.PathAndFileName(True)

VaultPath = VaultPath.Replace("C:\MyPath", "$")
'flip the slashes
VaultPath = VaultPath.Replace("\", "/")

Dim VaultPaths() As String = New String() {VaultPath}
 
Dim wsFiels() As AWS.File = mVltCon.WebServiceManager.DocumentService.FindLatestFilesByPaths(VaultPaths)
 
Dim mFileIt As VDF.Vault.Currency.Entities.FileIteration = New VDF.Vault.Currency.Entities.FileIteration(conn, wsFiels(0))
Dim FileProp As VDF.Vault.Currency.Properties.ContentSourcePropertyDefinition
Dim lifeCycleInfo As VDF.Vault.Currency.Entities.FileLifecycleInfo = mFileIt.LifecycleInfo
Dim CategoryInfo As VDF.Vault.Currency.Entities.EntityCategory = mFileIt.Category



MessageBox.Show(CategoryInfo.Name, "Title")
 
 
0 Likes
Message 4 of 6

g.georgiades
Advocate
Advocate
Accepted solution

You have an error on this line - your connection variable is mVltCon, not conn.

 

 

Dim mFileIt As VDF.Vault.Currency.Entities.FileIteration = 
     New VDF.Vault.Currency.Entities.FileIteration(conn, wsFiels(0))

 

 

It looks the original source also has the same error.

 

0 Likes
Message 5 of 6

f_calebh
Advocate
Advocate

That was it! I had the same variable error when grabbing Lifecycle state, so I'm not sure why that worked, but this was what I needed. Thanks!

 

 

 

0 Likes
Message 6 of 6

g.georgiades
Advocate
Advocate

The FileIteration object only needs the vault connection for a couple properties.... For the lifecycle state - it can pull directly from the WebServices File. When it grabs the category information - it has to ask the provided connection for it. If the connection is null, then it will not be able to query for the category. It seems you had bad luck in that the property you needed was one of the only ones that needed the connection...

 

Here is a debug dump from visual studio - the left side has null passed for the FileIteration connection. The only properties that it could not pull from the WebServices file are the Category and the EntityClass.... at least for a standard vault file.

ggeorgiades_0-1722337776764.png