1 Reply Latest reply on May 14, 2015 11:44 AM by Charley Saint

    IEdmGetBatch to Get Latest Version

    Greg Thomson

      Is there any easy way to use IEdmBatchGet to get all files below a folder?  Kind of like Explorer has?


      Or, do I need to add individual selections for each and every file?



        • Re: IEdmGetBatch to Get Latest Version
          Charley Saint

          I think this is close to what you looking for, just call traversefolders on a folder to add all the files to the batchgetter (I didn't compile this so it porbably doesn't work as is)


              Dim vault As IEdmVault10
              Dim batchgetter As IEdmBatchGet
              batchGetter = vault.CreateUtility(EdmUtility.EdmUtil_BatchGet)
              Private Function TraverseFiles(ByVal aFolder As IEdmFolder5)
                      Dim FilePos As IEdmPos5
                      FilePos = aFolder.GetFirstFilePosition
                      Dim file As IEdmFile5
                      Dim i As Integer
                      Dim aPos As IEdmPos5
                      Dim ppoSelection(0) As EdmSelItem
                      i = 0
                      While Not FilePos.IsNull
                          file = aFolder.GetNextFile(FilePos)
                          aPos = file.GetFirstFolderPosition
                          aFolder = file.GetNextFolder(aPos)
                          ReDim Preserve ppoSelection(i - 1)
                          ppoSelection(i) = New EdmSelItem
                          ppoSelection(i).mlDocID = file.ID
                          ppoSelection(i).mlProjID = aFolder.ID
                          i = i + 1
                      End While
                      batchgetter.AddSelection(vault, ppoSelection)
                  Catch ex As Runtime.InteropServices.COMException
                      MessageBox.Show("HRESULT = 0x" + _
                        ex.ErrorCode.ToString("X") + vbCrLf + _
                  Catch ex As Exception
                  End Try
              End Function
              Private Function TraverseFolders(ByVal aFolder As IEdmFolder5)
                  Dim FolderPos As IEdmPos5
                  FolderPos = aFolder.GetFirstSubFolderPosition
                  While Not FolderPos.IsNull
                      Dim SubFolder As IEdmFolder5
                      SubFolder = aFolder.GetNextSubFolder(FolderPos)
                  End While
              End Function