Hi,
I want to access/get the vault properties of the folder + parent folder of an idw, located in the folder, currently openend in Inventor via ilogic.
I've found other posts about similar topics, like getting the lifecyclestatus, but I can't manage to rebuild them to do what I want.
Any help is much apprecciated.
Solved! Go to Solution.
Solved by richterBKSAC. Go to Solution.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Would you please elaborate on your answer, if possible? I have access to the VaultSDK.chm file too.
This is what I'm using to get the current lifecyclestate of a file.
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
Sub Main()
Dim paras As Parameters
Dim para As Parameter
Dim propsets As PropertySets
Dim doc As Document = ThisDoc.Document
Dim mVltCon As VDF.Vault.Currency.Connections.Connection
mVltCon = VB.ConnectionManager.Instance.Connection
If mVltCon Is Nothing Then
MsgBox("Not logged in to Vault" )
Exit Sub
End If
MsgBox(get_vaultfilestatus(doc.FullFileName, mVltCon))
End Sub
Function get_vaultfilestatus(filepath As String, vaultconnection As VDF.Vault.Currency.Connections.Connection) As String
filepath = filepath.Replace("C:\xx\", "$/")
'flip the slashes
filepath = filepath.Replace("\", "/")
Dim VaultPaths() As String = New String() {filepath}
Dim wsFiels() As AWS.File = vaultconnection.WebServiceManager.DocumentService.FindLatestFilesByPaths(VaultPaths)
Dim mFileIt As VDF.Vault.Currency.Entities.FileIteration = New VDF.Vault.Currency.Entities.FileIteration(conn,wsFiels(0))
Dim lifeCycleInfo As VDF.Vault.Currency.Entities.FileLifecycleInfo = mFileIt.LifecycleInfo
Return lifeCycleInfo.StateName
'MessageBox.Show(lifeCycleInfo.StateName)
End Function
I've been digging a little in the VaultSDK.chm file and found a possible route, although I don't know to put it into code yet. Maybe someone could tell me if this route would be possible and/or provide some code.
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
Can't find what you're looking for? Ask the community or share your knowledge.