<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Uploading Files</title><link>https://www.aras.com/community/f/development/9568/uploading-files</link><description>Hi 
 I was trying to create a file and add to document item type using an AML query but getting File Item cannot be added 
 
 &amp;lt;AML&amp;gt; &amp;lt;Item type=&amp;quot;Document&amp;quot; action=&amp;quot;add&amp;quot;&amp;gt; &amp;lt;item_number&amp;gt;TEST&amp;lt;/item_number&amp;gt; &amp;lt;name&amp;gt;Hi&amp;lt;/name&amp;gt; &amp;lt;Relationships&amp;gt; &amp;lt;Item type=&amp;quot;Document</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: Uploading Files</title><link>https://www.aras.com/community/thread/9547?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2023 22:27:16 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:3557af31-8b29-4954-b230-ac362f55ef1e</guid><dc:creator>Troy R</dc:creator><description>&lt;p&gt;I know this is an old thread but for anyone in the future looking for how to add File Items via AML, here is how I was able to get it to work in Aras v12SP18:&lt;br /&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;Item type=&amp;#39;File&amp;#39; action=&amp;#39;add&amp;#39; id=&amp;#39;New32GUID&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;actual_filename&amp;gt;&lt;/span&gt;C:\Path\to\MyFile\filename.pdf&lt;span&gt;&amp;lt;/actual_filename&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;checkedout_path&amp;gt;&lt;/span&gt;C:\Path\to\MyFile&lt;span&gt;&amp;lt;/checkedout_path&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;filename&amp;gt;filename&lt;/span&gt;.pdf&lt;span&gt;&amp;lt;/filename&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;Relationships&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;Item type=&amp;#39;Located&amp;#39; action=&amp;#39;add&amp;#39;&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;related_id&amp;gt;32GUIDofVaultItemType&lt;/span&gt;&lt;span&gt;&amp;lt;/related_id&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;/Item&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;/Relationships&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;lt;/Item&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The key for me to get past the &amp;quot;File Item cannot be added&amp;quot; error was to ensure the &amp;quot;id&amp;quot; attribute in the beginning had a new unique 32 character GUID.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Uploading Files</title><link>https://www.aras.com/community/thread/7346?ContentTypeID=1</link><pubDate>Tue, 24 Aug 2021 14:31:12 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:269af605-6a8b-4168-8755-fced7a6cc449</guid><dc:creator>Jayraj Hogade</dc:creator><description>&lt;p&gt;Hello Angela,&lt;br /&gt;&lt;br /&gt;Unfortunately for now I have switched to API as it was possible in my context. AML used to work previously but for some reason not any more.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Uploading Files</title><link>https://www.aras.com/community/thread/7343?ContentTypeID=1</link><pubDate>Tue, 24 Aug 2021 08:44:55 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:5ff17a3f-bccf-45cf-aba8-aa7507058e32</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;Hi Jayrajvh,&lt;/p&gt;
&lt;p&gt;were you able to find a solution for this one? I right now also tried to upload files with pure AML. I remember that it worked in the past without problems.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Uploading Files</title><link>https://www.aras.com/community/thread/4983?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 12:21:18 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:5e416fe0-a366-4a5f-9388-a66b30cb95db</guid><dc:creator>Jayraj Hogade</dc:creator><description>&lt;p&gt;Same issue I have. I think there is some change in ARAS behaviour of file handling. I have ARAS 12 and simple file upload with Document or without document is failing when I try AML way. Same thing works fine using API.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Uploading Files</title><link>https://www.aras.com/community/thread/4856?ContentTypeID=1</link><pubDate>Thu, 23 Apr 2020 06:30:50 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:af33e2b6-2558-4e6e-87a9-edd49ffbe41c</guid><dc:creator>gktcs12</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Thanks for the reply. I&amp;#39;m aware of this approach using the IOM. But, I wanna do both in AML in one query.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank You&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Uploading Files</title><link>https://www.aras.com/community/thread/4855?ContentTypeID=1</link><pubDate>Thu, 23 Apr 2020 05:05:46 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:c3e73a4e-64c5-46a1-8aab-fff0e9ff5403</guid><dc:creator>prafulsh.gurav@gmail.com</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;First you have to create file in Aras and then attach that to Document using File Id.&lt;/p&gt;
&lt;p&gt;Create file :&amp;nbsp;&lt;br /&gt;Item file = inn.newItem(&amp;quot;File&amp;quot;, &amp;quot;add&amp;quot;);&lt;br /&gt;file.attachPhysicalFile(&amp;quot;C:\\Backup\\1\\1.txt&amp;quot;);&lt;br /&gt;file.setProperty(&amp;quot;filename&amp;quot;, &amp;quot;1.txt&amp;quot;);&lt;br /&gt;file = file.apply();&lt;/p&gt;
&lt;p&gt;string fileId = file.getID();&lt;/p&gt;
&lt;p&gt;Then add file to relationship of Document :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;AML&amp;gt;&lt;br /&gt;&amp;lt;Item type=&amp;quot;Document&amp;quot; action=&amp;quot;add&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;item_number&amp;gt;TEST&amp;lt;/item_number&amp;gt;&lt;br /&gt;&amp;lt;name&amp;gt;Hi&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;lt;Relationships&amp;gt;&lt;br /&gt;&amp;lt;Item type=&amp;quot;Document File&amp;quot; action=&amp;quot;add&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;related_id&amp;gt;&lt;strong&gt;fileId&lt;/strong&gt;&amp;lt;/related_id&amp;gt;&lt;br /&gt;&amp;lt;/Item&amp;gt;&lt;br /&gt;&amp;lt;/Relationships&amp;gt;&lt;br /&gt;&amp;lt;/Item&amp;gt;&lt;br /&gt;&amp;lt;/AML&amp;gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>