Open Vault's "Generate File Number" pop-up using API

Open Vault's "Generate File Number" pop-up using API

carlos_henrique37ZCB
Explorer Explorer
264 Views
1 Reply
Message 1 of 2

Open Vault's "Generate File Number" pop-up using API

carlos_henrique37ZCB
Explorer
Explorer

Hi everyone,

 

This pop-up will appear each time I use a 'Save As' option. When using the API to 'Save As' a file, the pop-up does not show up, and I can't use the Vault's file number generator, which I must. It seems like it is not implemented in the API yet. Are there any workarounds? I need to save many files at once, and without the API, I will have to do this manually because the files must be saved with the correct number sequence.

carlos_henrique37ZCB_0-1716464652620.png


could be something as simple as:

 

Dim VaultFileName As String
VaultFileName = 'opens pop-up so I can select the next code of the file name and returns the string'

 

Thanks for the help

 

0 Likes
265 Views
1 Reply
Reply (1)
Message 2 of 2

m_baczewski
Advocate
Advocate

Hi, here is a method that returns the number of names you need, which are generated in the vault. This might help you:

  • "RequiredSchemeName" <-- Scheme name
  • "RequiredSchemeString" <-- Can be empty
  • numberOfNames <-- The number of names you need.

You must remember not to enter too large a number by accident, because that amount will be reserved in the Vault.

 

'heading
AddReference
"Autodesk.Connectivity.WebServices" AddReference "Autodesk.DataManagement.Client.Framework.Forms" AddReference "Autodesk.DataManagement.Client.Framework.Vault" AddReference "Autodesk.DataManagement.Client.Framework.Vault.Forms" AddReference "Connectivity.InventorAddin.EdmAddin" Imports ACW = Autodesk.Connectivity.WebServices Imports VDF = Autodesk.DataManagement.Client.Framework Imports Autodesk.DataManagement.Client.Framework.Vault.Services Imports Autodesk.DataManagement.Client.Framework.Vault.Currency.Connections Imports edm = Connectivity.InventorAddin.EdmAddin

 Here is a function, which return List with number from vault. 

 

Function getFilenamesFromVaultNamingScheme(RequiredSchemeName As String, RequiredSchemeString As String, numberOfNames As Integer)
Dim Connection As VDF.Vault.Currency.Connections.Connection = edm.EdmSecurity.Instance.VaultConnection()
Dim genNum As String = String.Empty
Dim names As New List(Of String)

If Not Connection Is Nothing Then
	Dim entityClassId = VDF.Vault.Currency.Entities.EntityClassIds.Files
	Dim numSchemes As ACW.NumSchm() = Connection.WebServiceManager.NumberingService.GetNumberingSchemes(entityClassId, Nothing)
	Dim requiredScheme As ACW.NumSchm = (From sch As ACW.NumSchm In numSchemes
	Where sch.Name = RequiredSchemeName
	Select sch).FirstOrDefault()
	Dim numGenArgs() As String = {RequiredSchemeString}
	For i = 1 To numberOfNames
		genNum = Connection.WebServiceManager.DocumentService.GenerateFileNumber(requiredScheme.SchmID, numGenArgs)
		names.Add(genNum)
	Next
End If
	Return names
End Function

 

 

 

0 Likes