Uploading/Checking In a file to Vault using Vault Framework
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
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.