Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Vault 2014 Batch Checkin of IDW

3 REPLIES 3
Reply
Message 1 of 4
Dickerson2012
536 Views, 3 Replies

Vault 2014 Batch Checkin of IDW

I have about 50,000 Idw's files that will need to be updated and checked into the vault. The sample working but it is slow. Can I batch the checking. if so how ( Code Sample )?

 

'My very slow loop check-in

Public Sub oVDFSample(ByVal oFileNameListWOEXT As List(Of String), connection As VDF.Vault.Currency.Connections.Connection)
        For Each FileName As String In oFileNameListWOEXT
            Dim oFileIteration As VDF.Vault.Currency.Entities.FileIteration = getFileIteration(FileName & ".idw", connection)
            If oFileIteration Is Nothing Then
                'VDF.Vault.Library.ConnectionManager.LogOut(connection)
                MessageBox.Show("Unable to get FileIteration object, is the name of the file you are trying to check in correct?")
                Return
            End If
            Dim fldrPath As Autodesk.DataManagement.Client.Framework.Currency.FolderPathAbsolute = connection.WorkingFoldersManager.GetWorkingFolder(oFileIteration)
            Dim filePath As String = Path.Combine(fldrPath.ToString(), oFileIteration.EntityName)
            Dim filePathAbs As VDF.Currency.FilePathAbsolute = New VDF.Currency.FilePathAbsolute(filePath)
            Try
                If oFileIteration.IsCheckedOut = True Then
                    Dim myFileRelationshipSettings As VDF.Vault.Settings.FileRelationshipGatheringSettings '.IFileRelationshipGatheringSettingsReadOnly
                    myFileRelationshipSettings = New VDF.Vault.Settings.FileRelationshipGatheringSettings
                    myFileRelationshipSettings.IncludeChildren = True
                    myFileRelationshipSettings.IncludeAttachments = True
                    Dim myColOfFileAssocLite As System.Collections.Generic.IEnumerable(Of ACW.FileAssocLite) = Nothing
                    myColOfFileAssocLite = connection.FileManager.GetFileAssociationLites(New Long() {oFileIteration.EntityIterationId}, myFileRelationshipSettings)
                    ' Going to add new FileAssocParam object to this list
                    Dim fileAssocLiteParams As ArrayList = New ArrayList


                    ' ArrayList to contain FileAssocParam objects
                    Dim fileAssocParams As ArrayList = New ArrayList

                    ' Add FileAssocParam objects to the  ArrayList
                    ' using values from the collection of FileAssocLite in the
                    ' collection returned from GetFileAssociationLites()
                    If Not myColOfFileAssocLite Is Nothing Then
                        Dim myFileAssocLite As FileAssocLite
                        '    'Go through each FileAssoc in the FilleAssocs in the collection of FileAssocLite
                        For Each myFileAssocLite In myColOfFileAssocLite
                            ' This is a new FileAssocParam that is going to be added to the ArrayList
                            ' getting the properties from the FileAssocLite
                            Dim par As FileAssocParam = New FileAssocParam()
                            par.CldFileId = myFileAssocLite.CldFileId
                            par.RefId = myFileAssocLite.RefId
                            par.Source = myFileAssocLite.Source
                            par.Typ = myFileAssocLite.Typ
                            par.ExpectedVaultPath = myFileAssocLite.ExpectedVaultPath
                            fileAssocParams.Add(par)
                        Next
                    End If
                    ' and the new file
                    Dim myFileAssocParamArray As FileAssocParam() = DirectCast(fileAssocParams.ToArray(GetType(FileAssocParam)), FileAssocParam())
                    connection.FileManager.CheckinFile(oFileIteration, "CodeVauleUpdate", False, myFileAssocParamArray,
                                                                                     Nothing, False, Nothing,
                                                          ACW.FileClassification.None, False, filePathAbs)
                End If
            Catch ex As Exception
                Debug.Print(ex.ToString)
                connection.FileManager.UndoCheckoutFile(oFileIteration, filePathAbs)
            End Try
        Next
    End Sub

3 REPLIES 3
Message 2 of 4
joe
Contributor
in reply to: Dickerson2012

Your code has helped me understand the principles behind file checkin. Thank you.
Did you ever manage to simplify and speed things up?
Message 3 of 4
Boorda
in reply to: Dickerson2012

You could try using a BackgroundWorker thread for each check-in routine, then it would be multi-threaded. I'm just not sure what Vault's limitations are when it comes to checking in files. Can Vault handle concurrent check-ins?

Automation is key!
Message 4 of 4

Batch Check in's are painfully slow for all releases> Any time i have to deal with multiple files and checkout-checking  I create automation and run it directly on the server. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report