Read file iProperty from Vault

Read file iProperty from Vault

Anonymous
Not applicable
7,034 Views
28 Replies
Message 1 of 29

Read file iProperty from Vault

Anonymous
Not applicable

How would I go about reading the Revision number iProperty, of the active inventor file, from Vault using either VBA or VB.net?

0 Likes
7,035 Views
28 Replies
Replies (28)
Message 2 of 29

Anonymous
Not applicable

Sorry, just read that back and its not very clear.

I'm trying to read the iProperty value of the active Inventor document as it is in Vault, using the Inventor application either through the iLogic or VBA environment. I wish to compare the iProp value of the local file vs the vaulted version.

0 Likes
Message 3 of 29

bradeneuropeArthur
Mentor
Mentor
Hi,

What version of inventor and vault ate you using.

Then I can take a look at the coding.

Regards

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 4 of 29

bradeneuropeArthur
Mentor
Mentor
After your info I could take a look at the coding.
Because te coding is different for each version release.

Thank you.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 5 of 29

Anonymous
Not applicable

I'm using Inventor 2017 Pro and Vault Basic 2017

 

Thanks

0 Likes
Message 6 of 29

bradeneuropeArthur
Mentor
Mentor

Hi,

 

  • Create a new inventor 2017 add in
  • Make the following additional references
Imports Inventor
Imports System.Runtime.InteropServices
Imports Autodesk.Connectivity.Extensibility.Framework
Imports Autodesk.Connectivity.WebServices
Imports Autodesk.Connectivity.WebServicesTools
Imports Connectivity.InventorAddin.EdmAddin
Imports VDF = Autodesk.DataManagement.Client.Framework


Private moDocSvc As Autodesk.Connectivity.WebServices.DocumentService
  • Add this code to your "SetupUserInterface"
Public Sub SetupUserInterface(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal firstTime As Boolean, ClientID As String)
		
			Dim strVaulrServerName As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.Server
            Dim strVaultName As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.VaultName
            Dim strVaultUserName As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.UserName
            Dim strVaultPassword As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.Password

            Dim results As VDF.Vault.Results.LogInResult

            results = VDF.Vault.Library.ConnectionManager.LogIn(strVaulrServerName, strVaultName, strVaultUserName, "", VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, Nothing)

            Dim conn As VDF.Vault.Currency.Connections.Connection = Nothing

            If results.Success Then

                conn = results.Connection                
               
            End If

            moDocSvc = conn.WebServiceManager.DocumentService

        End Sub
  • Create a Button
Private Sub m_ButtenDef_OnExecute(Context As Inventor.NameValueMap) Handles m_LargeButtonDefinition.OnExecute, m_SmallButtonDefinition.OnExecute
            Dim Odoc As Document = m_inventorApplication.ActiveDocument
            Dim VaultFile As String = Odoc.FullFileName.Replace("YOU LOCAL VAULT PATH", "$")
            VaultFile = VaultFile.Replace("\", "/")
            
            Dim hh() As Autodesk.Connectivity.WebServices.File = moDocSvc.FindLatestFilesByPaths(New String() {VaultFile})

            MsgBox(" THE REVISION OF THE FILE = " & hh(0).FileRev.Label)
        Exit Sub

Hope this will help you.

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 7 of 29

Anonymous
Not applicable

Thank you for you reply. I've managed to create a project from the Inventor 2017 add-in template, compile it and see it load in Inventor (that's the furthest I've ever got to in creating my own add-in !!)

 

I'm now running into errors however when attempting to add your code, see attached image. It's like its not recognizing the imported references.

 

Could you perhaps look at my project file and see where I'm going wrong? (see attached)

 

thanks

0 Likes
Message 8 of 29

bradeneuropeArthur
Mentor
Mentor

Hi,

 

I will take a look at your project ASAP.

but first set these references in your project (See Picture)References add in.PNG

 

Let me know if I need to take a look at the coding or if it has been solved herewith?

 

Regards,

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 9 of 29

Anonymous
Not applicable

Thanks, that's taken care of the references. Just down to 3 errors left now (see attached image)

 

Appreciate the help!

0 Likes
Message 10 of 29

Anonymous
Not applicable

@bradeneuropeArthur

 

I think I traced it back to here. I'm not sure how to reference an icon/bitmap for my button?

0 Likes
Message 11 of 29

bradeneuropeArthur
Mentor
Mentor
You need to add an icon to your project resources. Than add this with icontoipicture to your button.

If needed I can show you how tommorow.

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 12 of 29

bradeneuropeArthur
Mentor
Mentor

Hi,

 

The following:

 

  • add an icon to your resources of the project.

Resources.PNG

 

  • Create a button picture by using IconToPicture method using this resource icon. The green marked is only a marked undeline message and will not lead into errors.IconToIPuctureIconToIPucture

If this is not solving your problem today, I will take a look at the complete coding tomorrow.

Hope this will help you with your problem.

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 13 of 29

Anonymous
Not applicable

Great thank you, I managed to add an image (jpeg) to my project resources and use it on this line:

Dim largeIcon As stdole.IPictureDisp = PictureDispConverter.ToIPictureDisp(My.Resources.iPropVault)

 

This got rid of the errors and I then built the solution again. It built successfully but I got a warning also, not sure if that affects anything?

I've noticed the dll file updates but the .ADDIN file doesn't. 

Build Results.JPG

 

The good news is I can see the button now in Inventor and clicking on it produces a messagebox I added to the start of the Sub to display Odoc.FullFileName Smiley Happy

Vault Add-in.JPG

 

The bad news is, the image is not appearing on the button and I'm not getting the message box showing the revision of the vaulted file.

 

Any clues as to what could be happening?

0 Likes
Message 14 of 29

bradeneuropeArthur
Mentor
Mentor

The .Addin file is only an Xml File and will not change normally spoken, this is correct.

regarding the picture:

  • What framework are you using?

Regarding the revision:

  • are you logged in to the vault.
  • To test you could put msgbox into the code to look how far you are coming in the process without errors.

Otherwise send me the code as private message so I can take a look at it. or place the add in code as txt file here.

 

 

 

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 15 of 29

Anonymous
Not applicable

I'm using .NET Framework 4.5

 

Attached code as .txt file

 

Getting as far as message box showing the active document full file name.

 

Unfortunately I'm only using VS express version so I can't debug by stepping through the code. I'm having to build the solution again each time and test in Inventor.

 

If there was an error on this line, is there any way to see it?

Dim hh() As Autodesk.Connectivity.WebServices.File = moDocSvc.FindLatestFilesByPaths(New String() {VaultFile})

 

I'm assuming this is where the error is as it's not reaching the last messagebox of the button sub.

0 Likes
Message 16 of 29

Anonymous
Not applicable

P.s I am logged into Vault

0 Likes
Message 17 of 29

bradeneuropeArthur
Mentor
Mentor

You forgot to add the pictures to the button!

 

This will solve the button issue.

The rest I will take a look at later.

 

let me know if the icon button issue has been solved!

 

please copy and replace:

' Sample to illustrate creating a button definition.
            Dim largeIcon As stdole.IPictureDisp = PictureDispConverter.ToIPictureDisp(My.Resources.iPropVault)
            Dim smallIcon As stdole.IPictureDisp = PictureDispConverter.ToIPictureDisp(My.Resources.iPropVault)
            Dim controlDefs As Inventor.ControlDefinitions = g_inventorApplication.CommandManager.ControlDefinitions
            m_sampleButton = controlDefs.AddButtonDefinition("Command Name", "Internal Name", CommandTypesEnum.kShapeEditCmdType, AddInClientID,"ButtonLargeDescription",
                                                                       "ButtonLargeToolTipText", oSmallIcon, oLargeI
con)

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 18 of 29

bradeneuropeArthur
Mentor
Mentor

HI,

 

I assume that you are logging in with a password, or not.

if you are using a password then you also need it in your code.

 

please then replace the following line with this one.

 

            results = VDF.Vault.Library.ConnectionManager.LogIn(strVaulrServerName, strVaultName, strVaultUserName, strVaultPassword, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, Nothing)

Did I t work?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes
Message 19 of 29

Anonymous
Not applicable

@bradeneuropeArthur

I have made that change to the line you suggested and still had no success.

 

I tried moving the contents of the SetupUserInterface sub into  the m_sampleButton_OnExecute private sub and it now gets to the last message box.

 

Although the FileRev.Label is blank Smiley Frustrated

 

I checked vault and it should have a value of "A"

 

see code below:

Private Sub m_sampleButton_OnExecute(Context As Inventor.NameValueMap) Handles m_sampleButton.OnExecute

Dim strVaulrServerName1 As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.Server
Dim strVaultName1 As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.VaultName
Dim strVaultUserName1 As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.UserName
Dim strVaultPassword1 As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.Password

Dim results1 As VDF.Vault.Results.LogInResult

results1 = VDF.Vault.Library.ConnectionManager.LogIn(strVaulrServerName1, strVaultName1, strVaultUserName1, strVaultPassword1, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, Nothing)

Dim conn1 As VDF.Vault.Currency.Connections.Connection = Nothing

If results1.Success Then

conn1 = results1.Connection

MsgBox("Connected to Vault")

End If

moDocSvc = conn1.WebServiceManager.DocumentService

Dim Odoc As Document = g_inventorApplication.ActiveDocument
MsgBox(Odoc.FullFileName)
Dim VaultFile As String = Odoc.FullFileName.Replace("C:\_Vault-WIP", "$")
VaultFile = VaultFile.Replace("\", "/")
MsgBox(VaultFile)

Dim hh() As Autodesk.Connectivity.WebServices.File = moDocSvc.FindLatestFilesByPaths(New String() {VaultFile})

MsgBox(hh(0).Name)

MsgBox(" THE REVISION OF THE FILE = " & hh(0).FileRev.Label)

Exit Sub
End Sub

0 Likes
Message 20 of 29

bradeneuropeArthur
Mentor
Mentor

For my understanding:

The button icon issue has been solved?

the messages in green are given correct?

the messages in red is not given correctly, but messagebox is appearing?

 

 

 

Private Sub m_sampleButton_OnExecute(Context As Inventor.NameValueMap) Handles m_sampleButton.OnExecute

Dim strVaulrServerName1 As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.Server
Dim strVaultName1 As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.VaultName
Dim strVaultUserName1 As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.UserName
Dim strVaultPassword1 As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.Password

Dim results1 As VDF.Vault.Results.LogInResult

results1 = VDF.Vault.Library.ConnectionManager.LogIn(strVaulrServerName1, strVaultName1, strVaultUserName1, strVaultPassword1, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, Nothing)

Dim conn1 As VDF.Vault.Currency.Connections.Connection = Nothing

If results1.Success Then

conn1 = results1.Connection

MsgBox("Connected to Vault")

End If

moDocSvc = conn1.WebServiceManager.DocumentService

Dim Odoc As Document = g_inventorApplication.ActiveDocument
MsgBox(Odoc.FullFileName)
Dim VaultFile As String = Odoc.FullFileName.Replace("C:\_Vault-WIP", "$")
VaultFile = VaultFile.Replace("\", "/")
MsgBox(VaultFile)

Dim hh() As Autodesk.Connectivity.WebServices.File = moDocSvc.FindLatestFilesByPaths(New String() {VaultFile})

MsgBox(hh(0).Name)

MsgBox(" THE REVISION OF THE FILE = " & hh(0).FileRev.Label)

Exit Sub
End Sub

 

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


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:
My 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 !


 


EESignature

0 Likes