For future users, here is how I managed to get the property value of a vault property attached to a folder in vault.
AddReference "Autodesk.Connectivity.WebServices.dll"
Imports AWS = Autodesk.Connectivity.WebServices
AddReference "Autodesk.DataManagement.Client.Framework.Vault.dll"
Imports VDF = Autodesk.DataManagement.Client.Framework
AddReference "Connectivity.Application.VaultBase.dll"
Imports VB = Connectivity.Application.VaultBase
AddVbFile "iLogic_Basis.vb"
Sub Main()
Dim doc As Document = ThisDoc.Document
'Vault Connection
Dim mVltCon As VDF.Vault.Currency.Connections.Connection
mVltCon = VB.ConnectionManager.Instance.Connection
If mVltCon Is Nothing Then
MsgBox("Not logged into Vault",,"Error" )
Exit Sub
End If
'insert the property name as string
vault_get_folder_prop(doc.FullFileName, mVltCon, "yourPropertyName")
End Sub
Function vault_get_folder_prop(filepath As String, vaultconnection As VDF.Vault.Currency.Connections.Connection, propname As String) As String
'complete the path to your local vault working directory
filepath = filepath.Replace("C:\XX\", "$/")
'flip the slashes
filepath = filepath.Replace("\", "/")
Dim VaultPaths() As String = New String() {filepath}
Dim wsFiles() As AWS.File = vaultconnection.WebServiceManager.DocumentService.FindLatestFilesByPaths(VaultPaths)
Dim mFileIt As AWS.File = New VDF.Vault.Currency.Entities.FileIteration(conn, wsFiles(0))
'get the folder ID of the folder your currently opened Inventor file is located in
Dim folderid As Long = mFileIt.FolderId
'get the property definition ID of your desired property
Dim pdefs() As AWS.PropDef = vaultconnection.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FLDR")
Dim propdef_ID As Long
For Each propdef In pdefs
If propdef.DispName = propname Then
propdef_ID = propdef.Id
End If
Next
'get the property value of your desired property
Dim propValues As AWS.PropInst() = vaultconnection.WebServiceManager.PropertyService.GetProperties("FLDR", New Long(){folderid},New Long(){propdef_ID})
Dim propValue As String = DirectCast(propValues(0).Val, String)
Return propValue
End Function