I am writing code to attempt to get the last parent assembly in pro pro for a child object. The code runs out of objects, and I realize this logic 'If ref.GetNextParent(pos).Name = _file Then' is not possible. Just playing a little. They have all kinds of getnext parent options, bit no gerprevious options, being that I would like the previous parent.
Also, it seems probable that the same children could have different parents, so how is this confirmed?
Thanks, code below:
Private Function GetParent2(_file As String) As IEdmReference7
Dim ref As IEdmReference7
Dim Vfile As IEdmFile5 = Nothing
Dim ParentFolder As IEdmFolder5 = Nothing
Vfile = VAULT.GetFileFromPath(_file, ParentFolder)
ref = Vfile.GetReferenceTree(ParentFolder.ID)
Dim pos As IEdmPos5
Dim Parent As IEdmReference7
pos = ref.GetFirstParentPosition2(0, False, EdmRefFlags.EdmRef_File + EdmRefFlags.EdmRef_Item + EdmRefFlags.EdmRef_Dynamic + EdmRefFlags.EdmRef_Static)
Do Until IsNothing(ref.GetNextParent(pos))
If ref.GetNextParent(pos).Name = _file Then
Parent = ref.GetNextParent(pos)