6 Replies Latest reply on Jul 27, 2013 8:36 AM by Lee CS Young

    GetVersionVars bug.. Maybe fixed someday?

    Brian Dalton

      I'm trying for the first time to use GetVersionVars (using example code from the API reference file) and it keeps throwing exception 438 (Object does not support this method).


      After spending quite some time trying to figure out what was wrong, I came upon some posts online (a different forum) mentioning that there was a bug in the API.  The posts were from 2008 (ie, Five.Years.Ago)


      If there is something I can do about getting this to work I would appreciate some help.  If it's just SW being disgustingly slow to fix a $#(*&#$ bug, the shame shame shame on them.

        • Re: GetVersionVars bug.. Maybe fixed someday?
          Tim Webb



          I have not seen this before. I'm going to throw together a quick add-in to check it myself and post back in a few minutes.


          Tim CEPA


            • Re: GetVersionVars bug.. Maybe fixed someday?
              Tim Webb

              Hi again Brian.


              I put together the sample code from the API help file, compiled, and it works. Disclaimer: I set the code to to return the latest version variables so that is an unknown that could cause an issue.


              Hope this helps

              Tim CEPA



              Here's the screenshot from the message box it posted. This particular file has 9 versions but these are the vars from the latest version.




              Here's the code I used:


              Imports EdmLib


              Public Class GetVersionVars

                  Implements EdmLib.IEdmAddIn5


                  Public Sub GetAddInInfo(ByRef poInfo As EdmLib.EdmAddInInfo, ByVal poVault As EdmLib.IEdmVault5, ByVal poCmdMgr As EdmLib.IEdmCmdMgr5) Implements EdmLib.IEdmAddIn5.GetAddInInfo


                      'Just some information for the Administrate Add-ins dialog box

                      poInfo.mbsAddInName = "EPDM GetVersionVars"

                      poInfo.mbsCompany = "equivaQ Software, LLC. <www.equivaq.com>"

                      poInfo.mbsDescription = "Custom EPDM add-in used to pull multiple version variables."

                      poInfo.mlAddInVersion = 1

                      poInfo.mlRequiredVersionMajor = 5

                      poInfo.mlRequiredVersionMinor = 2


                      poCmdMgr.AddCmd(1001, "GetVersionVars Tool", EdmMenuFlags.EdmMenu_ShowInMenuBarTools + EdmMenuFlags.EdmMenu_MustHaveSelection, "Launch The GetVersionVars Tool", "Launch The GetVersionVars Tool", , )


                  End Sub


                  Public Sub OnCmd(ByRef poCmd As EdmLib.EdmCmd, ByRef ppoData As System.Array) Implements EdmLib.IEdmAddIn5.OnCmd


                      'Check the command ID to make sure it is our command that was called.

                      If poCmd.mlCmdID = 1001 Then

                          Dim strSelectionInfo As String = " "


                          'Retrieve the bounds of the array containing the selected files and folders

                          Dim index As Long

                          Dim last As Long

                          index = LBound(ppoData)

                          last = UBound(ppoData)

                          Dim StrID As String = ""


                          'Create a message showing the names and IDs of all selected files and folders.

                          Dim message As String = "You have selected the following files and folders: " + vbLf


                          While index <= last


                              If ppoData(index).mlObjectID1 = 0 Then 'mlObjectID1=0 if a folder is selected, acts as a flag to alert developer we are looking at a folder

                                  message = message + "Folder: (ID=" & StrID & " )"

                                  message = message + " : " & ppoData(index).mlObjectID2 'mlObjectID2 = ID of folder

                              Else 'otherwise mlObjectID1 is the ID of the selected file, <> 0 is a flag to alert developer we are looking at a file

                                  message = message + "Folder: (ID=" & StrID & " )"

                                  message = message + " : " & ppoData(index).mlObjectID1 'mlObjectID1 = ID of file


                                  Dim eFile As IEdmFile6 'dimension a file

                                  Dim eFolder As IEdmFolder5 'dimension a folder

                                  Dim vault As IEdmVault10 'vault object

                                  vault = poCmd.mpoVault 'get the vault object

                                  eFile = vault.GetObject(EdmObjectType.EdmObject_File, ppoData(index).mlObjectID1) 'get the file object

                                  eFolder = vault.GetObject(EdmObjectType.EdmObject_Folder, ppoData(index).mlObjectID3) 'get the folder object the file is in

                                  ShowVersionVars(eFile, eFolder.ID, 0) 'call the ShowVersionVars from the API sample code and return the latest version

                              End If


                              message = message + ppoData(index).mbsStrData1 + vbLf 'mbsStrData1 = name of active configuration

                              index = index + 1


                          End While

                      End If


                  End Sub


                  'Sample code from the API help file

                  Private Sub ShowVersionVars(ByVal poFile As IEdmFile6, ByVal iFolderID As Integer, ByVal iVer As Integer)


                      Dim poEnum As IEdmEnumeratorVariable7

                      poEnum = poFile.GetEnumeratorVariable


                      Dim oVarData As EdmGetVarData

                      Dim aoVars() As Object

                      Dim aoCfgs() As String


                      poEnum.GetVersionVars(iVer, iFolderID, aoVars, aoCfgs, oVarData)


                      Dim sMsg As String

                      Dim iVarIdx As Integer


                      iVarIdx = LBound(aoVars)


                      While (iVarIdx <= UBound(aoVars))

                          Dim poVal As IEdmVariableValue6

                          poVal = aoVars(iVarIdx)

                          sMsg = sMsg + poVal.VariableName + " = "

                          Dim iCfgIdx As Integer

                          iCfgIdx = LBound(aoCfgs)

                          While (iCfgIdx <= UBound(aoCfgs))

                              Dim sCfgName As String

                              sCfgName = aoCfgs(iCfgIdx)

                              iCfgIdx = iCfgIdx + 1

                              sMsg = sMsg + "(" + sCfgName + " : " + poVal.GetValue(sCfgName) + ") "

                          End While

                          sMsg = sMsg + vbLf

                          iVarIdx = iVarIdx + 1

                      End While



                  End Sub


              End Class

            • Re: GetVersionVars bug.. Maybe fixed someday?
              Brian Dalton

              Thanks for putting in the time, Tim.  I used a workaround for now, but I'd like to get back to the GetVersionVars function at some point.