2 Replies Latest reply on Jun 24, 2014 1:45 PM by Danny Bradford

    IEdmBatchUnlock error on AddSelection: Invalid Parameter

    Danny Bradford



      I am trying to run IEdmBatchUnlock and have an on AddSelection. I am running VB.NET. I have tried every variation found on Google with no success. I have brought in sample code from scratch from Solidworks websites and it hits the exact same error.


      I am running ePDM 2012 so I use "Imports EdmLib" on launch. Could this be a bug in this version?


      My goal is to search the system for all files checked out by the individual running this tool and having the system check it all in. A one button end of the day easy check it all in function.


      The search function is not solid yet, but it works well enought for this testing.


              Dim userMgr As IEdmUserMgr7

              userMgr = vault1

              Dim user As IEdmUser8

              user = userMgr.GetLoggedInUser

              Dim list_files() As EdmSelItem = Nothing


               Dim retval1 As Boolean


               Dim Check_In_List As IEdmBatchUnlock

              Dim User_Comments As String

              Dim i As Integer = 0

              ReDim list_files(200)

              User_Comments = "Auto Checked in from Dashboard"


               Check_In_List = vault1.CreateUtility(EdmUtility.EdmUtil_BatchUnlock)


              Dim Search As IEdmSearch5

              Search = vault1.CreateUtility(EdmUtility.EdmUtil_Search)


              Search.FindLockedFiles = True

              Search.FindUnlockedFiles = False



              Dim Result As IEdmSearchResult5

              Result = Search.GetFirstResult


               While Not Result Is Nothing

                  If Result.LockedByUserName = user.FullName.ToString Then


                      list_files(i) = New EdmSelItem

                      list_files(i).mlDocID = Result.ID

                      list_files(i).mlProjID = Result.ParentFolderID

                      MsgBox("Would check in: " & list_files(i).mlDocID & "  Locked by:  " & list_files(i).mlProjID & "  " & i)

                      i = i + 1



                  End If



                  Result = Search.GetNextResult


              End While


              Array.Resize(list_files, i + 1)



                  Check_In_List = DirectCast(vault1.CreateUtility(EdmUtility.EdmUtil_BatchUnlock), IEdmBatchUnlock)

                  Check_In_List.AddSelection(DirectCast(vault1, EdmVault5), list_files)



      This last line of code is the error. Your time and help is greatly appreciated.