<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get datalink path from closed drawing C# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6350543#M35933</link>
    <description>&lt;P&gt;Did you notice that DataLink class has a method&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;GetSourceFiles()&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume you can loop through DataLinkDictionary for each DataLink available in the drawing, and for each DataLink object, use GetSourceFiles() to find out the linked data source file path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 May 2016 14:25:08 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2016-05-26T14:25:08Z</dc:date>
    <item>
      <title>Get datalink path from closed drawing C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6349525#M35930</link>
      <description>&lt;P&gt;I am wanting to get the path(s) of all the datalinks in a closed drawing, without opening the drawing in AutoCAD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the number of drawings that need to be inspected will be unknown, I dont want to deal with the delay of opening the drawing in AutoCAD since there could be a large number of drawings.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using the DataLinkManager I have been able to see how many datalinks are in a closed drawing, but I have not been able to figure out how to get the path of each datalink.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 22:47:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6349525#M35930</guid>
      <dc:creator>klonbeck</dc:creator>
      <dc:date>2016-05-25T22:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Get datalink path from closed drawing C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6350490#M35931</link>
      <description>&lt;P&gt;Given the fact that namespace Autodesk.AutoCAD.DatabaseServices in acdbmgd.dll covers the related classes/properties&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DataLink&lt;/P&gt;
&lt;P&gt;DataLinkManager&lt;/P&gt;
&lt;P&gt;Database.DataLinkDictionaryId&lt;/P&gt;
&lt;P&gt;Database.DataLinkManager&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume you can open a drawing as side database and access these classes/properties for the information you need. But I have not done anything in .NET API with DataLink. Just a thought.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 14:02:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6350490#M35931</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2016-05-26T14:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get datalink path from closed drawing C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6350514#M35932</link>
      <description>&lt;P&gt;Thank you for the reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes I am able to open a drawing in a side database and read through the database. I have found the datalink members that you listed, but I have not been able to discover how to get the path that the datalink is pointing to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as our use of the datalinks we typically use the relative path option instead of the full path option. Not sure if this makes a difference in how I need to get the path of the datalink.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 14:12:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6350514#M35932</guid>
      <dc:creator>klonbeck</dc:creator>
      <dc:date>2016-05-26T14:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get datalink path from closed drawing C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6350543#M35933</link>
      <description>&lt;P&gt;Did you notice that DataLink class has a method&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;GetSourceFiles()&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume you can loop through DataLinkDictionary for each DataLink available in the drawing, and for each DataLink object, use GetSourceFiles() to find out the linked data source file path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 14:25:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6350543#M35933</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2016-05-26T14:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get datalink path from closed drawing C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6350825#M35934</link>
      <description>&lt;P&gt;I had not noticed the&amp;nbsp;GetSourceFiles().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will check it out.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 16:22:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6350825#M35934</guid>
      <dc:creator>klonbeck</dc:creator>
      <dc:date>2016-05-26T16:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get datalink path from closed drawing C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6351222#M35935</link>
      <description>&lt;P&gt;Using your point of looping through the&amp;nbsp;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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");
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code does not show the creation of the side database since I am only interested in the datalink(s) in the drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value of RelativePath is&amp;nbsp;".\\PROJECT_FILES\\PANEL_MAPS\\EXTRUDER ENCLOSURE LABELS.xls!Plabel_1!Plabel_1".&lt;/P&gt;&lt;P&gt;The&lt;SPAN&gt; value of TruePath is&amp;nbsp;"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"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I try to use "DataLinkItem.GetSourceFiles(DataLinkGetSourceContext.OrignalPath)" the returned value is "0". Maybe I am misusing the&amp;nbsp;GetSourceFiles() but I was not able to get a file path out of it. Am I using&amp;nbsp;GetSourceFiles() incorrectly?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 19:45:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6351222#M35935</guid>
      <dc:creator>klonbeck</dc:creator>
      <dc:date>2016-05-26T19:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get datalink path from closed drawing C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6352645#M35936</link>
      <description>There may be a better way of getting the result that I am looking for, but I am going to accept this as the solution. This gives me a value that I can work with and it will meet the needs of the application I am working on.&lt;BR /&gt;&lt;BR /&gt;Thank you for the help.</description>
      <pubDate>Fri, 27 May 2016 14:08:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-datalink-path-from-closed-drawing-c/m-p/6352645#M35936</guid>
      <dc:creator>klonbeck</dc:creator>
      <dc:date>2016-05-27T14:08:08Z</dc:date>
    </item>
  </channel>
</rss>

