Uploading/Checking In a file to Vault using Vault Framework

Uploading/Checking In a file to Vault using Vault Framework

pmartick
Advocate Advocate
1,227 Views
4 Replies
Message 1 of 5

Uploading/Checking In a file to Vault using Vault Framework

pmartick
Advocate
Advocate

Inventor 2021, hopefully getting 2023 within the next month

 

Using this post https://justonesandzeros.typepad.com/blog/2013/05/how-to-acquire-files.html

And other posts finding out the methods of getting, checking category, current state, and current checkout/in status, of files from Vault is now very easy to me.

 

What's starting to become a bit of a pain is checking a file back into Vault regardless if it's a new file or not.

 

Getting or checking out a file is simple:

AddReference "Autodesk.Connectivity.WebServices.dll"
AddReference "Autodesk.DataManagement.Client.Framework.Vault.dll"
AddReference "Connectivity.Application.VaultBase.dll"
Imports Autodesk.Connectivity.WebServices
Imports VDF = Autodesk.DataManagement.Client.Framework
Imports VB = Connectivity.Application.VaultBase
oVltCon = VB.ConnectionManager.Instance.Connection oSettings = New VDF.Vault.Settings.AcquireFilesSettings(oVltCon, False) oSettings.AddFileToAcquire(New VDF.Vault.Currency.Entities.FileIteration(oVltCon, oVltCon.WebServiceManager.DocumentService.FindLatestFilesByPaths(New String() {"$/Workspace/FileName.iam" })(0)), VDF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Download)'Or AcquisitionOption.Checkout oVltCon.FileManager.AcquireFiles(oSettings)

 

So far it looks like checking a file back in, or "UploadFileSettings" as it's called, should be just as simple:

 

oSettings = New VDF.Vault.Settings.UploadFilesSettings(oVltCon)
oSettings.AddFileToUpload("D:\Work\Workspace\FileName.iam")
oVltCon.FileManager.UploadFiles(oSettings)

Unfortunately that oSettings.AddFileToUpload method only accepts a FilePathAbsolute Object instead of a string of the file name.

 

I can create the FilePathAbsolute object in iLogic and see there are parameters for FileExtension, FileName, FolderPath, etc., but they're all Read Only.  I can't figure out how to create this object and input the file data.

Dim oPath As Autodesk.DataManagement.Client.Framework.Currency.FilePathAbsolute

 

pmartick_0-1663083075677.png

 

I'm hoping someone can help convert a string of a filename into a FilePathAbsolute object for the UploadFile setting.

 

If I'm not on the right path, what is the correct method for checking a file into Vault?

 

I do know the method for calling the control definition for "VaultCheckin" and "VaultCheckinTop", but those aren't viable for my solution, I'm basically looking to make code that automatically copies an assembly file from a template, configures basic parameters, iLogic in the files takes care of everything else in the files, saves it, then automatically uploads/checks in to Vault and releases it without any extra input from the user.

 

Thank you ahead of time for your help.

0 Likes
1,228 Views
4 Replies
Replies (4)
Message 2 of 5

matt_jlt
Collaborator
Collaborator

Unfortunately it isn't that simple. It looks like you are just adding a file to vault which is completely different to checking a file into vault. If you search the Inventor + Vault forums and also look at the Vault SDK you will find a lot of information on this.
From memory you need to gather a list of the files, get all of the file associations, links etc. and check it all in. 

0 Likes
Message 3 of 5

pmartick
Advocate
Advocate

I'll try looking around, hopefully somewhere on the internet someone posted an example that I can adapt to my needs.  I'm fine with writing code that gathers all the necessary info, it's just putting in the proper format where it gets annoying.

 

I did see there's a Checkin method with the IFileManager interface in the Vault SDK api guide, sadly that guide doesn't contain examples and is not as easy to navigate as the Inventor api guide.

0 Likes
Message 4 of 5

matt_jlt
Collaborator
Collaborator

Have a look at the vault customisation forums, plenty of good info on there

0 Likes
Message 5 of 5

tyler.warner
Advocate
Advocate

Hey @pmartick , one of these posts on the Vault Customization Forum may answer your question.

 

Check In Multiple Files - Best Practice? (link) 

How to upload and check in a modified file to vault (link) 

Check in file/s with possibility to type a comment (link) 

Vault File Associations when Checking In (link) 

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
0 Likes