<?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: Updating a part property using the API adds assemblies to the &amp;quot;Uses&amp;quot; tab in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13291400#M294</link>
    <description>&lt;P&gt;I already answered your question, but the discussion about the alternate option overlayed it: Yes, I recommend including children. If there are none, then it's no problem, but if there are (as explained in my first answer, a part file can have a child relationship), you will lose them if IncludeChildren is set to false.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2025 18:52:49 GMT</pubDate>
    <dc:creator>Markus.Koechl</dc:creator>
    <dc:date>2025-01-30T18:52:49Z</dc:date>
    <item>
      <title>Updating a part property using the API adds assemblies to the "Uses" tab</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13288905#M289</link>
      <description>&lt;P&gt;I have a Vault Add-on the lookups up the current part description from an ERP system and updates the part's description property.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ron_m_0-1738176180990.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1460572i08AFAEF0E626B26C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ron_m_0-1738176180990.png" alt="ron_m_0-1738176180990.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The function is based on the example from justonesandzeros.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://justonesandzeros.typepad.com/blog/2015/02/another-way-to-update-properties.html" target="_blank"&gt;http://justonesandzeros.typepad.com/blog/2015/02/another-way-to-update-properties.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The code has been recently updated from Vault 2022 to 2024.&lt;/P&gt;&lt;P&gt;CheckIn:&lt;/P&gt;&lt;P&gt;File newFile = mgr.DocumentService.CheckinUploadedFile(&lt;BR /&gt;selectedFile.MasterId, "Update from PAI JCS: " + UpdateMessage, false, DateTime.Now,&lt;BR /&gt;GetFileAssociations(selectedFile, connection), null, true, selectedFile.Name, selectedFile.FileClass,&lt;BR /&gt;selectedFile.Hidden, uploadTicket.ToByteArray());&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the following for file associations.&lt;/P&gt;&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR /&gt;/// Return list of file associations for given file.&lt;BR /&gt;/// &lt;A href="http://adndevblog.typepad.com/manufacturing/2013/09/vault-2014-api-example-that-adds-a-file-and-associates-it-to-an-existing-file-in-the-vault.html" target="_blank"&gt;http://adndevblog.typepad.com/manufacturing/2013/09/vault-2014-api-example-that-adds-a-file-and-associates-it-to-an-existing-file-in-the-vault.html&lt;/A&gt;&lt;BR /&gt;/// &amp;lt;/summary&amp;gt;&lt;BR /&gt;/// &amp;lt;param name="selectedFile"&amp;gt;Selected file.&amp;lt;/param&amp;gt;&lt;BR /&gt;/// &amp;lt;param name="connection"&amp;gt;Current Vault Connection.&amp;lt;/param&amp;gt;&lt;BR /&gt;/// &amp;lt;returns&amp;gt;Array of file association paramiters&amp;lt;/returns&amp;gt;&lt;BR /&gt;private FileAssocParam[] GetFileAssociations(File selectedFile, VDF.Vault.Currency.Connections.Connection connection)&lt;BR /&gt;{&lt;BR /&gt;// Settings used in GetFileAssociationLites()&lt;BR /&gt;VDF.Vault.Settings.FileRelationshipGatheringSettings myFileRelationshipSettings = new VDF.Vault.Settings.FileRelationshipGatheringSettings();&lt;BR /&gt;&lt;BR /&gt;myFileRelationshipSettings.IncludeAttachments = true;&lt;BR /&gt;myFileRelationshipSettings.IncludeChildren = true;&lt;BR /&gt;myFileRelationshipSettings.IncludeParents = true;&lt;BR /&gt;myFileRelationshipSettings.IncludeRelatedDocumentation = true;&lt;BR /&gt;// added to get DWF references&lt;BR /&gt;myFileRelationshipSettings.IncludeHiddenEntities = true;&lt;BR /&gt;myFileRelationshipSettings.IncludeLibraryContents = true;&lt;/P&gt;&lt;P&gt;// Current associations for file&lt;BR /&gt;System.Collections.Generic.IEnumerable&amp;lt;FileAssocLite&amp;gt; myColOfFileAssocLite =&lt;BR /&gt;connection.FileManager.GetFileAssociationLites(selectedFile.Id.ToSingleArray(), myFileRelationshipSettings);&lt;/P&gt;&lt;P&gt;// Go though each FileAssocLite to add to list&lt;BR /&gt;List&amp;lt;FileAssocParam&amp;gt; fileAssocParams = new List&amp;lt;FileAssocParam&amp;gt;();&lt;BR /&gt;if (myColOfFileAssocLite != null)&lt;BR /&gt;{&lt;BR /&gt;foreach (FileAssocLite myFileAssocLite in myColOfFileAssocLite)&lt;BR /&gt;{&lt;BR /&gt;// skip self dependency&lt;BR /&gt;if (!(myFileAssocLite.Typ == AssociationType.Dependency &amp;amp;&amp;amp;&lt;BR /&gt;myFileAssocLite.CldFileId == selectedFile.Id))&lt;BR /&gt;{&lt;BR /&gt;FileAssocParam par = new FileAssocParam();&lt;BR /&gt;par.CldFileId = myFileAssocLite.CldFileId;&lt;BR /&gt;par.RefId = myFileAssocLite.RefId;&lt;BR /&gt;par.Source = myFileAssocLite.Source;&lt;BR /&gt;par.Typ = myFileAssocLite.Typ;&lt;BR /&gt;par.ExpectedVaultPath = myFileAssocLite.ExpectedVaultPath;&lt;BR /&gt;fileAssocParams.Add(par);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return fileAssocParams.ToArray();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I set&amp;nbsp;IncludeChildren to false if the file is a part?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 18:47:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13288905#M289</guid>
      <dc:creator>ron_m</dc:creator>
      <dc:date>2025-01-29T18:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a part property using the API adds assemblies to the "Uses" tab</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13290410#M290</link>
      <description>&lt;P&gt;Part files can have a parent-child relationship: a derived part can derive from an assembly or a part file. So, if part file derives another part, a property update must not lose the relationship. An alternate approach to updating property values without the overhead of managing the associations is to use the IExplorerUtil.UpdateFileProperties() method. You can find an implementation sample here:&amp;nbsp;&lt;A href="https://github.com/koechlm/iLogic-Vault/blob/895d9a4e5098064a61ea06f7e9d24a2b6fb7f46c/iLogic-Vault-QuickstartLibrary/iLogic-Vault%20QuickstartLibrary.cs#L1954" target="_blank"&gt;https://github.com/koechlm/iLogic-Vault/blob/895d9a4e5098064a61ea06f7e9d24a2b6fb7f46c/iLogic-Vault-QuickstartLibrary/iLogic-Vault%20QuickstartLibrary.cs#L1954&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 11:58:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13290410#M290</guid>
      <dc:creator>Markus.Koechl</dc:creator>
      <dc:date>2025-01-30T11:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a part property using the API adds assemblies to the "Uses" tab</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13290598#M291</link>
      <description>&lt;P&gt;Thank you for your input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The JustOnesAndZeros document from 2015 listed that as an option but stated that IExplorerUtil.UpdateFileProperties was "&lt;STRONG&gt;&lt;EM&gt;prone to failure&lt;/EM&gt;&lt;/STRONG&gt;" when used though the API. Has this changed since then? I am using his alternative to the 2 "Sucky Options".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the article&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;&lt;EM&gt;Sucky option 2 is to use IExplorerUtil.UpdateFileProperties in the Vault API.&amp;nbsp; On paper, this is a great function.&amp;nbsp; It loads up core pieces of Vault Explorer libraries and executes the Edit Properties command just as if a user had done it through the UI.&amp;nbsp; It even handles the checkout/checkin.&amp;nbsp; The problem is that it’s a bulky operation and prone to failure.&amp;nbsp; Vault Explorer simply wasn’t meant to be invoked from the API.&amp;nbsp;&amp;nbsp;IExplorerUtil was always indented to be a temporary solution until something better came along.&amp;nbsp; And that something better is here....&lt;/EM&gt;"&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, 30 Jan 2025 13:36:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13290598#M291</guid>
      <dc:creator>ron_m</dc:creator>
      <dc:date>2025-01-30T13:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a part property using the API adds assemblies to the "Uses" tab</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13291159#M292</link>
      <description>&lt;P&gt;I agree that the IExplorerUtil might not be the best choice for large batches, as internally, it is a cascading process. However, this API call is widely used and has been stabilized over the years, so it is a valid option with pros and cons. &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2537627"&gt;@ron_m&lt;/a&gt;: As&amp;nbsp;you already implemented and just asked about the option to include/exclude children, I don't see why you need to change the strategy. Nevertheless, the community following this thread should know that - from a coding perspective - there is an alternate option. So, thank you for adding the citations, which added the details that each approach has its characteristics.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 17:04:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13291159#M292</guid>
      <dc:creator>Markus.Koechl</dc:creator>
      <dc:date>2025-01-30T17:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a part property using the API adds assemblies to the "Uses" tab</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13291358#M293</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't implemented the&amp;nbsp;&lt;EM&gt;IExplorerUtil.UpdateFileProperties &lt;/EM&gt;code&lt;EM&gt;.&amp;nbsp;&lt;/EM&gt;I will be looking into it and possible addition to the add-on as an option being as it's only handling 1 file at a time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The end of my original post is asking about a possible fix using my current code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"Should I set&amp;nbsp;IncludeChildren to false if the file is a part?"&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, 30 Jan 2025 18:30:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13291358#M293</guid>
      <dc:creator>ron_m</dc:creator>
      <dc:date>2025-01-30T18:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a part property using the API adds assemblies to the "Uses" tab</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13291400#M294</link>
      <description>&lt;P&gt;I already answered your question, but the discussion about the alternate option overlayed it: Yes, I recommend including children. If there are none, then it's no problem, but if there are (as explained in my first answer, a part file can have a child relationship), you will lose them if IncludeChildren is set to false.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 18:52:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13291400#M294</guid>
      <dc:creator>Markus.Koechl</dc:creator>
      <dc:date>2025-01-30T18:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a part property using the API adds assemblies to the "Uses" tab</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13291503#M295</link>
      <description>&lt;P&gt;So, setting it False will cause problems for parts that do have child relationships.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The part my user contacted me about did not have any child relationships. He showed that using my vault add-on to update the description, the add-on somehow added child relationships to some assemblies. Obviously, this is a bug in the add-on.&amp;nbsp; To fix it he opened the part in Inventor, checked it out, saved it, checked it in. After that process, vault showed the part correctly with no child relationships.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was hoping to figure out the bug in my code. As noted, we recently update from 2022 to 2024. The Add-On was updated to use the new 2024 API and version code,&amp;nbsp;[assembly: Autodesk.Connectivity.Extensibility.Framework.ApiVersion("17.0")].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the past I had problems after updating to 2022 where an add-on for our ERP system that import bills from the vault failed. I was using the un-documented file bill and thin client which now fails because the file IDs changed in the vault with the update. Ended up using a much slower process utilizing temporary Item bills and thick client.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 19:50:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13291503#M295</guid>
      <dc:creator>ron_m</dc:creator>
      <dc:date>2025-01-30T19:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a part property using the API adds assemblies to the "Uses" tab</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13293356#M296</link>
      <description>&lt;P&gt;Switch to the&amp;nbsp;UpdateFileProperties method.&lt;/P&gt;&lt;P&gt;Still don't know why my previous method failed but the new one works and is simpler.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2025 16:47:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/updating-a-part-property-using-the-api-adds-assemblies-to-the/m-p/13293356#M296</guid>
      <dc:creator>ron_m</dc:creator>
      <dc:date>2025-01-31T16:47:33Z</dc:date>
    </item>
  </channel>
</rss>

