Vault connection with iLogic

ThatWorksForMe
Advocate
Advocate

Vault connection with iLogic

ThatWorksForMe
Advocate
Advocate

Hi,

I use Inventor/Vault Pro 2018 at the moment and so following code works fine.

On the new version (2022) this code works also (without errors) but the messagebox is empty.

 

Header of this file:

 

 

'API for Vault connection
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

 

 

 

File:

 

 

	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")
		Return "error"
	End If

	Dim VaultPath As String = oDoc.FullFileName
	'Dim VaultPath As String = ThisDoc.PathAndFileName(True)
	VaultPath = VaultPath.Replace(Environ("USERPROFILE") & "\Workspace\", "$/")
	'flip the slashes
	VaultPath = VaultPath.Replace("\", "/")

	Dim VaultPaths() As String = New String() {VaultPath}
 
	Dim wsFiels() As AWS.File = mVltCon.WebServiceManager.DocumentService.FindLatestFilesByPaths(VaultPaths)
	MsgBox(wsFiels(0).FileRev.Label.ToString)

	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
	If (GetData = "SetRev") And oDoc.FullFileName.Contains(ThisDoc.FileName(False)) = True Then
		MsgBox(iProperties.Value(oDoc, "Custom", "TEST_Version") & "," & wsFiels(0).FileRev.Label)
	End If

 

 

 

The problem is, that the Messagebox 

 

wsFiels(0).FileRev.Label

 

is always empty.

In Inventor 2018 it is filled correctly, but in Inventor 2022 not.

 

I have already seen a solution by MarkusKoechl, but is there an easy solution for that problem with this code?

Regards

 

PDM/CAD Administrator
Using Inventor/Vault 2022.2
0 Likes
Reply
Accepted solutions (1)
733 Views
2 Replies
Replies (2)

bradeneuropeArthur
Mentor
Mentor
Replace this
VaultPath = VaultPath.Replace(Environ("USERPROFILE") & "\Workspace\", "$/")
with this
VaultPath = VaultPath.Replace(Environ("USERPROFILE") & "\Workspace\", "$")

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
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 !

0 Likes

ThatWorksForMe
Advocate
Advocate
Accepted solution

Thanks @bradeneuropeArthur 

My fault was more simple. I apologize for wasting your time. I forgot "2022" in the path for the workspace.

**** hardcoded directories. 

PDM/CAD Administrator
Using Inventor/Vault 2022.2
0 Likes