<?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: AddFile and FileAssocParams argument in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330306#M4280</link>
    <description>&lt;P&gt;You can do this in one step by using FileManager.AddFile method. To get a better understanding of the FileAssocParam[] array, I suggest debugging a sample assembly file using&amp;nbsp;GetLatestFileAssociationsByMasterIds. I recently created a sample doing this:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; #region capture dependencies
                //we need to return all relationships during later check-in
                List&amp;lt;ACW.FileAssocParam&amp;gt; mFileAssocParams = new List&amp;lt;ACW.FileAssocParam&amp;gt;();
                ACW.FileAssocArray mFileAssocArray = mWsMgr.DocumentService.GetLatestFileAssociationsByMasterIds(new long[] { mFile.MasterId },
                    ACW.FileAssociationTypeEnum.None, false, ACW.FileAssociationTypeEnum.All, false, false, false, true).FirstOrDefault();
                if (mFileAssocArray.FileAssocs != null)
                {
                    foreach (ACW.FileAssoc item in mFileAssocArray.FileAssocs)
                    {
                        ACW.FileAssocParam mFileAssocParam = new ACW.FileAssocParam();
                        mFileAssocParam.CldFileId = item.CldFile.Id;
                        mFileAssocParam.ExpectedVaultPath = item.ExpectedVaultPath;
                        mFileAssocParam.RefId = item.RefId;
                        mFileAssocParam.Source = item.Source;
                        mFileAssocParam.Typ = item.Typ;
                        mFileAssocParams.Add(mFileAssocParam);
                    }
                }

                #endregion capture dependencies

....
// checkin new file version
                VDF.Currency.FilePathAbsolute vdfPath = new VDF.Currency.FilePathAbsolute(mLocalFileFullName);
                FileIteration mUploadedFile = null;
                try
                {
                    if (mFileAssocParams.Count &amp;gt; 0)
                    {
                        mUploadedFile = mConnection.FileManager.CheckinFile(mNewFileIteration, "Created by Custom Job executing iLogic : " + mAllRulesTextWrp,
                                                false, mFileAssocParams.ToArray(), null, true, null, mFileIteration.FileClassification, false, vdfPath);
                    }
                    else
                    {
                        mUploadedFile = mConnection.FileManager.CheckinFile(mNewFileIteration, "Created by Custom Job executing iLogic : " + mAllRulesTextWrp,
                                                false, null, null, false, null, mFileIteration.FileClassification, false, vdfPath);
                    }

                }
                catch
.....&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Feb 2020 09:34:42 GMT</pubDate>
    <dc:creator>Markus.Koechl</dc:creator>
    <dc:date>2020-02-20T09:34:42Z</dc:date>
    <item>
      <title>AddFile and FileAssocParams argument</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330067#M4278</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I’m trying to use the add file method with FileAssocParams, but it seems I’m missing something as when I check the results in the thick client, I see an “Unknown status” icon, pseudo code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Parent&lt;/P&gt;&lt;P&gt;foreach (child in children)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;childId = Vault.AddFile(null);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Parent.addChildParam(FileAssocParam(childId))&lt;/P&gt;&lt;P&gt;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;Vault.AddFile(Parent,&amp;nbsp; Parent.FileAssocParams)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I need to link the children with the parent too?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 07:21:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330067#M4278</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2020-02-20T07:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: AddFile and FileAssocParams argument</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330265#M4279</link>
      <description>&lt;P&gt;So, if I check the files out, then back in again, the status is ok. Do I need to call addFile and CheckinFile?&lt;/P&gt;&lt;P&gt;Or is there a way to update the status without re-sending the file?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 09:15:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330265#M4279</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2020-02-20T09:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: AddFile and FileAssocParams argument</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330306#M4280</link>
      <description>&lt;P&gt;You can do this in one step by using FileManager.AddFile method. To get a better understanding of the FileAssocParam[] array, I suggest debugging a sample assembly file using&amp;nbsp;GetLatestFileAssociationsByMasterIds. I recently created a sample doing this:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; #region capture dependencies
                //we need to return all relationships during later check-in
                List&amp;lt;ACW.FileAssocParam&amp;gt; mFileAssocParams = new List&amp;lt;ACW.FileAssocParam&amp;gt;();
                ACW.FileAssocArray mFileAssocArray = mWsMgr.DocumentService.GetLatestFileAssociationsByMasterIds(new long[] { mFile.MasterId },
                    ACW.FileAssociationTypeEnum.None, false, ACW.FileAssociationTypeEnum.All, false, false, false, true).FirstOrDefault();
                if (mFileAssocArray.FileAssocs != null)
                {
                    foreach (ACW.FileAssoc item in mFileAssocArray.FileAssocs)
                    {
                        ACW.FileAssocParam mFileAssocParam = new ACW.FileAssocParam();
                        mFileAssocParam.CldFileId = item.CldFile.Id;
                        mFileAssocParam.ExpectedVaultPath = item.ExpectedVaultPath;
                        mFileAssocParam.RefId = item.RefId;
                        mFileAssocParam.Source = item.Source;
                        mFileAssocParam.Typ = item.Typ;
                        mFileAssocParams.Add(mFileAssocParam);
                    }
                }

                #endregion capture dependencies

....
// checkin new file version
                VDF.Currency.FilePathAbsolute vdfPath = new VDF.Currency.FilePathAbsolute(mLocalFileFullName);
                FileIteration mUploadedFile = null;
                try
                {
                    if (mFileAssocParams.Count &amp;gt; 0)
                    {
                        mUploadedFile = mConnection.FileManager.CheckinFile(mNewFileIteration, "Created by Custom Job executing iLogic : " + mAllRulesTextWrp,
                                                false, mFileAssocParams.ToArray(), null, true, null, mFileIteration.FileClassification, false, vdfPath);
                    }
                    else
                    {
                        mUploadedFile = mConnection.FileManager.CheckinFile(mNewFileIteration, "Created by Custom Job executing iLogic : " + mAllRulesTextWrp,
                                                false, null, null, false, null, mFileIteration.FileClassification, false, vdfPath);
                    }

                }
                catch
.....&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Feb 2020 09:34:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330306#M4280</guid>
      <dc:creator>Markus.Koechl</dc:creator>
      <dc:date>2020-02-20T09:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: AddFile and FileAssocParams argument</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330378#M4281</link>
      <description>&lt;P&gt;Hello Markus,&lt;/P&gt;&lt;P&gt;Thank you for your reply, &amp;nbsp;mFileAssocArray.FileAssocs &amp;nbsp;from GetLatestFileAssociationsByMasterIds is NULL as I’m attempting to upload the children first, they are new files, and they are not associated with any other file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then try to upload the parent last, but because there are no associations, I have no way to assign RefId&lt;/P&gt;&lt;P&gt;It seems your sample is for files already on the server, and already have associations, is this correct?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 10:16:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330378#M4281</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2020-02-20T10:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: AddFile and FileAssocParams argument</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330556#M4282</link>
      <description>&lt;P&gt;Hi Daniel,&lt;BR /&gt;Indeed, my sample code was meant to analyze existing parent-child dependencies to better understand the FileAssocParam. You need to upload from child to parent while capturing each id and other parameters to build the FileAssocParam.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 12:03:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9330556#M4282</guid>
      <dc:creator>Markus.Koechl</dc:creator>
      <dc:date>2020-02-20T12:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: AddFile and FileAssocParams argument</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9412291#M4283</link>
      <description>&lt;P&gt;Via Fiddler, I can see that the Vault addin executes the GetLatestFilePathsByNames right before it prompts me to save a file before adding it to the Vault.&amp;nbsp; I am having sync issues adding Inventor files via the Vault API.&amp;nbsp; I am using the undocumented apprenctice call to get the refIds for the FileAssocParam objects but that is not solving the problem.&amp;nbsp; The expectedFilePath is correct as well.&amp;nbsp; The Vault addin resolver must be doing something that I'm not finding any information online to implement for a successful AddFile operation on Inventor assemblies.&amp;nbsp; Thoughts?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 14:20:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/addfile-and-fileassocparams-argument/m-p/9412291#M4283</guid>
      <dc:creator>GeorgeWilliams</dc:creator>
      <dc:date>2020-03-31T14:20:21Z</dc:date>
    </item>
  </channel>
</rss>

