Using an Enterprise PDM AddIn, I need to programmatically read variable data associated with a file - hopefully without having to lock the file.
In the following chunk of code, m_myFile is a IEdmFile5 object and is already set to a valid file object.
The .GetVarFromDb method ALWAYS returns false - whether or not the file is Locked (Checked Out). This call has never worked. Am I doing something wrong?
The .GetVar method returns False if the file is not locked, and returns True if the file is Locked (allowing me to subsequently check poReturnValue for the value of the variable)
Fundamentally I just need to read variable data associated with a specific file - and I don't want to lock that file to do it. Maybe I'm going about this wrong?
SolidworksApi macrosDim sVariableName As String = "Description"
Dim sConfigurationName As String = ""
Dim poReturnValue As New Object
Dim myEnumeratorVariable As IEdmEnumeratorVariable6 = m_myFile.GetEnumeratorVariable
Dim bPassed As Boolean
bPassed = myEnumeratorVariable.GetVarFromDb(sVariableName, sConfigurationName, poReturnValue)
MsgBox("bPassed 1 = [" & bPassed & "]")
bPassed = myEnumeratorVariable.GetVar(sVariableName, sConfigurationName, poReturnValue)
MsgBox("bPassed 2 = [" & bPassed & "]")
If bPassed Then
txtVariableValue.Text = poReturnValue.ToString
End If
