PDM User-defined File References
Posted: Fri May 17, 2024 1:17 pm
I am writing a process for my add-in that will automatically create a user-defined file reference during the check in process. My code creates the references just fine. I know because I see the references when I click the "Custom References" button on the Contains tab.
The issue I am having is it doesn't show the references in the Bill of Materials or Contains tab and the referencing file doesn't show up in the Where Used of the referencing files. It also doesn't show the referenced files when I try to check out or transition the referencing file.
I tried a couple of different methods for adding the references: the IEdmAddCustomRefs2 & IEdmEnumeratorCustomReference7 interfaces. It feels like I am missing something in order to get the contains & where used trees to build.
'Use the previously obtained filenames to create a custom reference to the project file
Dim addCustRefs As IEdmAddCustomRefs2 = iVault.CreateUtility(EdmUtility.EdmUtil_AddCustomRefs)
addCustRefs.AddReferencesPath2(iFile.ID, sRefFilenames, iRefQtys)
addCustRefs.CreateTree(CInt(EdmCreateReferenceFlags.Ecrf_Nothing))
addCustRefs.CreateReferences()
OR
Dim iCustRef As IEdmEnumeratorCustomReference7 = iFile
Dim iRefFile As IEdmFile18 = iVault.GetFileFromPath(sRefFilenames(i))
Dim iFolder As IEdmFolder13 = iVault.GetFolderFromPath(iFolderPath)
iCustRef.AddReference3(iRefFile.ID, iFolder.ID, 1, True)
The issue I am having is it doesn't show the references in the Bill of Materials or Contains tab and the referencing file doesn't show up in the Where Used of the referencing files. It also doesn't show the referenced files when I try to check out or transition the referencing file.
I tried a couple of different methods for adding the references: the IEdmAddCustomRefs2 & IEdmEnumeratorCustomReference7 interfaces. It feels like I am missing something in order to get the contains & where used trees to build.
'Use the previously obtained filenames to create a custom reference to the project file
Dim addCustRefs As IEdmAddCustomRefs2 = iVault.CreateUtility(EdmUtility.EdmUtil_AddCustomRefs)
addCustRefs.AddReferencesPath2(iFile.ID, sRefFilenames, iRefQtys)
addCustRefs.CreateTree(CInt(EdmCreateReferenceFlags.Ecrf_Nothing))
addCustRefs.CreateReferences()
OR
Dim iCustRef As IEdmEnumeratorCustomReference7 = iFile
Dim iRefFile As IEdmFile18 = iVault.GetFileFromPath(sRefFilenames(i))
Dim iFolder As IEdmFolder13 = iVault.GetFolderFromPath(iFolderPath)
iCustRef.AddReference3(iRefFile.ID, iFolder.ID, 1, True)