How to get the referenced drawing for the old version of the part

The part has multiple versions of A, B, and C. Suppose you want to get the drawings of the A version of the part, how to achieve it.

GetReferenceTree Method(IedmFile5) & GetFirstParentPosition2 Method(Iedmreference5) The drawings obtained are the latest version C, not the required version A

Are you able to post the code you’re using to get this information? Without knowing how you’re accessing the data, it will be difficult to help narrow down the cause.

Off the top of my head, I’m thinking that you’ll have to get the IEdmReference5::VersionRef of the drawing and then perform Get on the file to cache that version. If you’re interested in the file’s variable data, use IEdmEnumeratorVariable7::GetVersionVars in order to get the variables associated with that specific version.


You are missing the second argument of the GetReferenceTree. By default, it will default to the latest version if omitted.

Btw, versions in PDM are numeric.

Second parameter.

When you use, GetLocalVersionNo, it’s getting the currently cached version of the file on your system. If you want to make sure you are working with the desired verison in your cache, you need to perform a Get command on IEdmReference5::VersionRef.

This code snippet may help

IEdmBatchGet batchGetter = (IEdmBatchGet)objVault.CreateUtility(EdmUtility.EdmUtil_BatchGet);
// Dictionary contains IEdmReference10 as the key and the file version to get as the value
foreach (KeyValuePair<IEdmReference10, int> KvPair in RefFilesDictionary)
    // format for AddSelectionEx(EdmVault5 poVault, int lFileID, int lParentFolderID, object oVersionOrFileDate)
    batchGetter.AddSelectionEx((EdmVault5)objVault, KvPair.Key.FileID, KvPair.Key.FolderID, KvPair.Value);
batchGetter.CreateTree((int)thisWindow.Handle, (int)EdmGetCmdFlags.Egcf_RefreshFileListing + (int)EdmGetCmdFlags.Egcf_SkipUnlockedWritable);
bool bRet = false;
bRet = batchGetter.ShowDlg((int)thisWindow.Handle); // this line can be skipped to keep from showing the dialog box, if this is commented out, set bRet to true
if (bRet)
  batchGetter.GetFiles((int)thisWindow.Handle, _callback);