New to the EPDM API as we are just now implementing a vault for the first time. I'm working on a solution for a machine that processes drawing files automatically and need to make sure the machine is checking in all the files it creates.
I can loop file.unlockFile and check them in individually but the api help specifically states using batchunlock is faster/more efficient. So I'm trying to use it but I'm stuck on the addselection method. It's throwing an error and telling me The Parameter Is Incorrect with an invalidarg error code.
I've tried everything I can think of. It's not like there's a lot going on and most of this code is copied right from the api help examples.
What am I missing?
Imports EPDM.Interop.epdm
Module Module1
Sub Main()
Try
Dim batchUnlocker As IEdmBatchUnlock = Nothing
Dim fileList As New List(Of String)
Dim vault5 As IEdmVault5 = New EdmVault5()
Dim vault7 As IEdmVault7 = DirectCast(vault5, IEdmVault7)
Dim file As IEdmFile5 = Nothing
Dim folder As IEdmFolder5 = Nothing
Dim selection() As EdmSelItem = Nothing
If Not vault7.IsLoggedIn Then
vault7.LoginAuto("Eng Vault", vbNull)
End If
batchUnlocker = vault7.CreateUtility(EdmUtility.EdmUtil_BatchUnlock)
Using reader As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:\filelist.txt")
While Not reader.EndOfData
fileList.Add(reader.ReadLine)
End While
reader.Close()
End Using
If fileList.Count = 0 Then
Exit Sub
Else
Array.Resize(selection, fileList.Count)
Dim i As Integer = 0
For Each filePath In fileList
file = vault7.GetFileFromPath(filePath, folder)
selection(i).mlDocID = file.ID
selection(i).mlProjID = folder.ID
i = i + 1
Next
batchUnlocker.AddSelection(vault5, selection)
End If
batchUnlocker.CreateTree(vbNull, EdmUnlockBuildTreeFlags.Eubtf_MayUnlock)
fileList = batchUnlocker.GetFileList(EdmUnlockFileListFlag.Euflf_GetUnlocked)
batchUnlocker.UnlockFiles(vbNull)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Module
SolidworksApi macros