AnsweredAssumed Answered

GetReferenceTree to include missing files

Question asked by D. Newton on May 28, 2020

Using VBA, I am trying to control which workflow a drawing goes to based on whether it's references are in the PDM folder or missing. I am trying to use the GetReferenceTree method to identify the references. If the reference part exists in the PDM folder then swPos is not null. If it does not exist then swPos is null as if there are no references. If I were to manually check in the file it shows a reference to the part with a warning "File Not Found".


Is there a way to use the GetReferenceTree method to identify missing references?


Below is a snippet of the code:


Private Sub runCheckForMissingFiles(pdmFolder As IEdmFolder8, pdmFile As IEdmFile10)

Dim swRefTree As IEdmReference5
Dim swPos As IEdmPos5
Dim swRef As IEdmReference5

Dim projName As String


Set swRefTree = pdmFile.GetReferenceTree(pdmFolder.ID)
Set swPos = swRefTree.GetFirstChildPosition(projName, True, True, 0)

While Not swPos.IsNull
   Set swRef = swRefTree.GetNextChild(swPos)

    'rest of code
End If