Run code on before the Vault check in

Run code on before the Vault check in

laurence.roijackers
Contributor Contributor
551 Views
3 Replies
Message 1 of 4

Run code on before the Vault check in

laurence.roijackers
Contributor
Contributor

Hello,

 

This might lean to Vault customization but it's about a specific step in Inventor.
I'm trying to do some things before the user can check something into Vault from Inventor.
I want to zoom to fit and check some iproperties.

I'm try to achieve this through an addin written in vb.net for Inventor 2022 with Vault professional 2022.

 

I think I have to find the right event for this,  I did find how to do that. (https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/handle-documentsercive-checkinfileev...  & https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/how-to-run-code-throuh-api-before-va... , I also found this, https://forums.autodesk.com/t5/inventor-ideas/check-in-as-an-event-trigger-for-ilogic-rules/idc-p/12... , where it claims an even trigger for iLogic is added that runs on check into Vault, but I tried 2024 and I can see the new Vault iLogic code, I can't find any Vault event triggers.)

 

I already knew that, even though in the UI it's called "Check In"  AwUN5WeWkG.png, it's actually either Check in or Add file.

 

So, I ended up with some code that works:

Friend Class VaultEvents
    Public Sub New()
        AddHandler Autodesk.Connectivity.WebServices.DocumentService.AddFileEvents.GetRestrictions, AddressOf OnAddFileGetRestrictions
        AddHandler Autodesk.Connectivity.WebServices.DocumentService.AddFileEvents.Pre, AddressOf OnAddFilePre
        AddHandler Autodesk.Connectivity.WebServices.DocumentService.AddFileEvents.Post, AddressOf OnAddFilePost
        AddHandler Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.GetRestrictions, AddressOf OnCheckInGetRestrictions
        AddHandler Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.Pre, AddressOf OnCheckIn
        AddHandler Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.Post, AddressOf OnCheckPost
        AddHandler MyEdmSecurity.VaultConnection.WebServiceManager.DocumentService.PostInvokeEvents, AddressOf PostInvokeEvents
    End Sub

    Private Sub OnAddFileGetRestrictions()
        MessageBox.Show("Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.GetRestrictions")
    End Sub
    Private Sub OnAddFilePre()
        MessageBox.Show("Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.Pre")
    End Sub
    Private Sub OnAddFilePost()
        MessageBox.Show("Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.GetPost")
    End Sub

    Private Sub OnCheckInGetRestrictions()
        MessageBox.Show("Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.GetRestrictions")
    End Sub

    Private Sub OnCheckIn()
        MessageBox.Show("Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.Pre")
    End Sub

    Private Sub OnCheckPost()
        MessageBox.Show("Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.Post")
    End Sub

    Private Sub PostInvokeEvents()
        MessageBox.Show("MyEdmSecurity.VaultConnection.WebServiceManager.DocumentService.PostInvokeEvents")
    End Sub

End Class

However, the event I look for isn't there, since they all come too late.

Event sequence.png

I'm hoping to find something between A and B.

Although, C could work for checking iproperties, but how do I abort the checkin? (instead of the message box)

 

Of course, I could also replace the check in button and run my code first and then use the command manger to "click" on the check in button. basically what the 2024 iLogic does:

ThisDoc.Save
Try
	Dim oControlDef As Inventor.ControlDefinition
	oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop")
	oControlDef.Execute2(True)
Catch ex As Exception
	Logger.Error("Check-In failed; likely, the file wasn't checked out.")
End Try

 But there are a lot of places where that button located and I rather don't go that way.

0 Likes
Accepted solutions (1)
552 Views
3 Replies
Replies (3)
Message 2 of 4

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Add this to your events:

Private Sub OnCheckIn(ByVal sender As Object, ByVal e As CheckinFileCommandEventArgs)
MessageBox.Show("Autodesk.Connectivity.WebServices.DocumentService.CheckinFileEvents.Pre")
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

Message 3 of 4

bradeneuropeArthur
Mentor
Mentor
and this in general for the addevents:

(ByVal sender As Object, ByVal e As AddFileCommandEventArgs)

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 4

laurence.roijackers
Contributor
Contributor

Thanks, that does give me the ability to run some checks and block the check in.

Now, I'm looking at the AddRestriction methode, what is meant with "human readable"?

laurenceroijackers_0-1690356958119.png

Most of the error messages users get in Vault aren't very useful, so I don't suppose that is "human readable"

Since they mostly tell something can't be done, but they don't tell which, for example, specific property is the problem.

 

But I see you can only get the FileMasterId, not the document from Inventor.

When adding the file only the FileName is available.

So this won't be as simple as I thought it would.

0 Likes