3 Replies Latest reply on Jun 8, 2016 1:56 PM by Sanya Shmidt

    Query EPDM for latest version

    Sanya Shmidt

      Hello Guys!

       

      Does anyone know how to query EPDM to see the latest version of the file/assembly and then compare to a local version via VB?

       

      I do know ho to get latest , but not sure how to check via api.

       

      Any help appreciated.

       

      Thanks,

        • Re: Query EPDM for latest version
          Artem Taturevych

          You can use IEdmFile5::GetFileCopy Method to get a copy of a file at any version and save it to a nominated location.

           

          Thanks,
          Artem

          • Re: Query EPDM for latest version
            Michael Dekoning

            If you just want to see the information, and not necessarily get the latest, compare IEdmFile5.CurrentVersion with the value returned by IEdmFile5.GetLocalVersionNo.

              • Re: Query EPDM for latest version
                Sanya Shmidt

                Thank Mike for the hint. Appreciate a lot. Here is the code if anyone interested.

                 

                Imports EdmLib

                Private Sub GetLatestModels()

                        'If you Then are developing In Visual Studio Like I was And have a reference Set To interop.edmLib you have To Do the following

                        'Go to "My Project" > "References" > Click on PDMWorks Enterprise 20xx Type Library > And set the "Embed Interop Types" to           False

                 

                        Try

                            Dim Vault As New EdmVault5

                            Vault.LoginAuto("TestVault", 0)

                            Dim SubFolder As String = Vault.RootFolderPath & "\blah\"

                 

                            ' start comparing versions##########################################################################

                            Dim aFile As IEdmFile8

                            aFile = Vault.GetFileFromPath(Vault.RootFolderPath & "\blah\blah.sldprt")

                 

                            'Get current version

                            Dim verVault, verLocal As Integer

                            verVault = aFile.CurrentVersion

                            'Get local version

                            verLocal = aFile.GetLocalVersionNo(Vault.RootFolderPath & "\blah\blah.sldprt")

                 

                            Debug.Print("Vault: " & verVault & vbNewLine & "Local: " & verLocal)

                 

                            If verVault = verLocal Then Exit Sub

                            ' end comparing versions##########################################################################

                 

                            ' in my case here I`m getting entire directory from Vault if local version of particular file is outdated

                            Dim GetDirectory() As EdmSelItem = Nothing

                            ReDim GetDirectory(0)

                            GetDirectory(0).mlDocID = 0

                            GetDirectory(0).mlProjID = Vault.GetFolderFromPath(SubFolder).ID

                 

                            Dim bg As IEdmBatchGet

                            bg = Vault.CreateUtility(EdmUtility.EdmUtil_BatchGet)

                            bg.AddSelection(Vault, GetDirectory)

                            bg.CreateTree(0, EdmGetCmdFlags.Egcf_Nothing)

                            bg.GetFiles(0, Nothing)

                 

                        Catch ex As Runtime.InteropServices.COMException

                            MessageBox.Show("Error : HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbCrLf + ex.Message)

                        Catch ex As Exception

                            MessageBox.Show(ex.Message)

                        End Try

                    End Sub