Using your point of looping through the DatalinkDictionary, I have been able to get to a point where I am able to get values that contain the relative path for the datalink and the true path of the datalink.
using (Transaction Tx = db.TransactionManager.StartTransaction())
{
ed.WriteMessage("\n---List of datlinks in drawing------------------");
using (DBDictionary DatalinkDictionary = (DBDictionary)Tx.GetObject(db.DataLinkDictionaryId, OpenMode.ForRead))
{
foreach (DBDictionaryEntry DlinkDictEntry in DatalinkDictionary)
{
DataLink DataLinkItem = (DataLink)DlinkDictEntry.Value.GetObject(OpenMode.ForRead);
string RelativePath = DataLinkItem.ConnectionString;
string TruePath = DataLinkItem.ToolTip;
ed.WriteMessage("\n---Relative Path---" + RelativePath);
ed.WriteMessage("\n---True Path---" + TruePath);
}
}
ed.WriteMessage("\n---End of datalink list-------------------------\n");
}
The code does not show the creation of the side database since I am only interested in the datalink(s) in the drawing.
The value of RelativePath is ".\\PROJECT_FILES\\PANEL_MAPS\\EXTRUDER ENCLOSURE LABELS.xls!Plabel_1!Plabel_1".
The value of TruePath is "Data Link\nPLABEL_1\nC:\\Vault\\Projects\\EXTRUDER\\43mm ENTEK\\Electrical Master Project\\PROJECT_FILES\\PANEL_MAPS\\EXTRUDER ENCLOSURE LABELS.xls\nLink details: Named range: Plabel_1"
While ConnectionString and ToolTip are padded with extra data, that extra data has so far been predictable. Striping off the extra data is an easy task so this would be one way I can get the value I want.
If I try to use "DataLinkItem.GetSourceFiles(DataLinkGetSourceContext.OrignalPath)" the returned value is "0". Maybe I am misusing the GetSourceFiles() but I was not able to get a file path out of it. Am I using GetSourceFiles() incorrectly?