<?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: Document GUID in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/document-guid/m-p/11763785#M9874</link>
    <description>&lt;P&gt;You might consider embed an GUID value in the drawing's named dictionary (of course create your own named Dictionary underneath the drawing's named dictionary).&lt;/P&gt;</description>
    <pubDate>Sat, 18 Feb 2023 03:22:37 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2023-02-18T03:22:37Z</dc:date>
    <item>
      <title>Document GUID</title>
      <link>https://forums.autodesk.com/t5/net-forum/document-guid/m-p/11763527#M9873</link>
      <description>&lt;P&gt;My plugin currently uses the document name + object handle as an identifier when saving records to an SQL database. I would like to use a more robust document id than the name, so that the document is seen as the same, even if it is moved to a different location, or if the file is renamed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried using the document hash, but this changes based on where the document is located. Same with the document.Database.FingerprintGuid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would creating a custom document property like myDocumentGUID be the best way to go?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 22:36:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/document-guid/m-p/11763527#M9873</guid>
      <dc:creator>drobertsY4GL3</dc:creator>
      <dc:date>2023-02-17T22:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Document GUID</title>
      <link>https://forums.autodesk.com/t5/net-forum/document-guid/m-p/11763785#M9874</link>
      <description>&lt;P&gt;You might consider embed an GUID value in the drawing's named dictionary (of course create your own named Dictionary underneath the drawing's named dictionary).&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 03:22:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/document-guid/m-p/11763785#M9874</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-02-18T03:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Document GUID</title>
      <link>https://forums.autodesk.com/t5/net-forum/document-guid/m-p/11763987#M9875</link>
      <description>&lt;P&gt;DWGPROPS, summary section, keywords or comments, or custom area is easy to read&lt;BR /&gt;XDATA attached to the 0 layer would be easy to access as well&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In ARX FingerprintGuid has a set and get, maybe you can assign the GUID, but then it might be a race between who sets it first, you or autocad.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I always thought FingerprintGuid never changed... odd&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 08:50:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/document-guid/m-p/11763987#M9875</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2023-02-18T08:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Document GUID</title>
      <link>https://forums.autodesk.com/t5/net-forum/document-guid/m-p/11771006#M9876</link>
      <description>&lt;P&gt;Thank you daniel and norman. Your suggestions worked great!&lt;/P&gt;&lt;P&gt;Below is the implementation I used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ViewModel:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; // Check document for GUID custom propery and assign if missing.
documentGUID = Utilities.GetDocumentGUID();
if(documentGUID == null)
{
    Utilities.SetDocumentGUID();
    var customizationSection = new Autodesk.AutoCAD.Customization.CustomizationSection();
    // Save the document after assigning a custom GUID property.
    customizationSection.Save();
    documentGUID = Utilities.GetDocumentGUID();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Helper Methods:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; public static string GetDocumentGUID()
{
    // Check if custom property exists.
    var document = Application.DocumentManager.MdiActiveDocument;

    System.Collections.IDictionaryEnumerator customProperties = document.Database.SummaryInfo.CustomProperties;

    while(customProperties.MoveNext())
    {
        var key = customProperties.Key.ToString();
        if(key == "DOCUMENT_GUID")
        {
            return customProperties.Value.ToString();
        }
    }

    return null;
}&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt; public static void SetDocumentGUID()
{
    // Create custom propery
    var document = Application.DocumentManager.MdiActiveDocument;
    var infoBuilder = new DatabaseSummaryInfoBuilder();
    var GUID = System.Guid.NewGuid().ToString();
    infoBuilder.CustomPropertyTable.Add("DOCUMENT_GUID", GUID);

    using (DocumentLock docLock = document.LockDocument())
    {
        document.Database.SummaryInfo = infoBuilder.ToDatabaseSummaryInfo(); 
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More info on creating custom properties:&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/net/create-document-custom-property/td-p/11763555" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/net/create-document-custom-property/td-p/11763555&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 20:11:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/document-guid/m-p/11771006#M9876</guid>
      <dc:creator>drobertsY4GL3</dc:creator>
      <dc:date>2023-02-21T20:11:48Z</dc:date>
    </item>
  </channel>
</rss>

