2 Replies Latest reply on Apr 8, 2015 2:51 PM by Larry Blakely

    Use IEdmBatchGet to get one file (one file only)

    Armando Saksono

      Hi All,

      This code snippet bellow works great. but not exactly what I want. I have another string that  has the exact file path

      StringModelIDFilePath. Can I use IEdmBatchGet to get one specific file rather than all file within a folder?

       

      StringModelIDFilePath = "C:\Slides1\Proposals\31000\Park\myFinalItem.SLDASM"

      StringModelIDPath = "C:\Slides1\Proposals\31000\Park\"

       

      Dim vault As New EdmVault5

      vault.LoginAuto "Slides1", 0

      Dim folders(1) As EdmSelItem

      folders(0).mlDocID = 0

      folders(0).mlProjID = vault.GetFolderFromPath("C:\Slides1" & StringModelIDPath).ID

      Dim bg As IEdmBatchGet

      Set bg = vault.CreateUtility(EdmUtil_BatchGet)

      bg.AddSelection vault, folders()

      bg.CreateTree 0, EdmGetCmdFlags.Egcf_SkipExisting

      bg.GetFiles 0, Nothing

        • Re: Use IEdmBatchGet to get one file (one file only)
          Armando Saksono

          I can't find the edit , to edit the original post. But I tried using string modelIDFilePath as below. but it still get all content within the folder rather than one specific myFinalItem.SLDASM

           

          Dim vault As New EdmVault5

          vault.LoginAuto "Slides1", 0

          Dim folders(1) As EdmSelItem

          'folders(0).mlDocID = 0

          folders(0).mlDocID = vault.GetFileFromPath("C:\Slides1" & ModelIDFilePath).ID

          folders(0).mlProjID = vault.GetFolderFromPath("C:\Slides1" & ModelIDPath).ID

          'folders(0).mlProjID = 0

          Dim bg As IEdmBatchGet

          Set bg = vault.CreateUtility(EdmUtil_BatchGet)

          bg.AddSelection vault, folders()

          bg.CreateTree 0, EdmGetCmdFlags.Egcf_SkipExisting

          bg.GetFiles 0, Nothing

            • Re: Use IEdmBatchGet to get one file (one file only)
              Larry Blakely

              This seems to work for me....hope it helps.

               

              Dim esi As New EdmSelItem

              Dim fldr As IEdmFolder5 = Nothing

              Dim File As IEdmFile5 = Nothing

              Dim ParentFolder As IEdmFolder5 = Nothing

              Dim FilePath As String = ""

               

              File = Vault.GetFileFromPath(FilePath, ParentFolder)

               

              fldr = Vault.GetFolderFromPath(ParentFolder.LocalPath)

                   

              If fldr IsNot Nothing Then

                        esi.mlDocID = File.ID

                        esi.mlProjID = fldr.ID

              End If

               

              Dim bg As IEdmBatchGet

              bg = Vault.CreateUtility(EdmUtility.EdmUtil_BatchGet)

              bg.AddSelectionEx(Vault, File.ID, fldr.ID, File.CurrentVersion)

              bg.CreateTree(Me.Handle.ToInt32(), EdmGetCmdFlags.Egcf_Nothing)

              bg.GetFiles(Me.Handle.ToInt32(), Nothing)