<?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>How to fetch file object of vaulted File with JS so we can later read the file content?</title><link>https://www.aras.com/community/f/development/9166/how-to-fetch-file-object-of-vaulted-file-with-js-so-we-can-later-read-the-file-content</link><description>Hi community, 
 does anybody a way to read the file content of existing Files in the Vault (mainly xml data) with Javascript? 
 For example we have an CAD item with an xml file in the property native_file. With an button click I want to read the filecontent</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to fetch file object of vaulted File with JS so we can later read the file content?</title><link>https://www.aras.com/community/thread/4508?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2020 07:57:58 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:e1a35117-21e3-4d4b-b835-34d8bc9bb6a3</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;Hi Cogres,&lt;/p&gt;
&lt;p&gt;At no time did I find your post accusatory -&amp;nbsp; nobody was more surprised than me&amp;nbsp;&amp;nbsp;&lt;span class="emoticon" data-url="https://www.aras.com/community/cfs-file/__key/system/emoji/1f606.svg" title="Laughing"&gt;&amp;#x1f606;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;I am also not sure about the security and performance aspect of my current solution. But in my use case this is not a big problem, cause the Method is mainly used for &lt;span&gt;occasional&amp;nbsp;&lt;/span&gt;data validation. It&amp;acute;s not a Method that is used on a daily basis by all users, so I think it should do the job.&lt;/p&gt;
&lt;p&gt;Angela&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fetch file object of vaulted File with JS so we can later read the file content?</title><link>https://www.aras.com/community/thread/4481?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2020 14:49:33 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:3057ace0-fad0-4ad3-9b71-cd2a0d131124</guid><dc:creator>cogres</dc:creator><description>&lt;p&gt;Hi Angela,&lt;/p&gt;
&lt;p&gt;I see! I didn&amp;#39;t mean it in an accusatory way whatsoever, just thought it was a little bit funny to find that you answered a very similar question a few years back :D.&lt;/p&gt;
&lt;p&gt;If what was written in the blog post we talked about still holds true, there is no IOM way of doing what you want to do. So we either have to REST it up (which is a little weird to do from within an already active Aras session, I agree), or do something similar to what you have suggested.&lt;br /&gt;Of course, I cannot really comment on the overall data security of doing it in either of those ways in your particular setup. But I cannot think of another clever way to do what you want to be doing either.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;/p&gt;
&lt;p&gt;C&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fetch file object of vaulted File with JS so we can later read the file content?</title><link>https://www.aras.com/community/thread/4476?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2020 10:41:41 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:e2baf9f3-d44d-4021-a03f-1ead27502a1e</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;Hi Cogres,&lt;/p&gt;
&lt;p&gt;you wouldn&amp;acute;t believe how often I google for a specific Innovator topic just to figure out that I already asked or answered the same question some time ago&amp;nbsp;.&lt;span class="emoticon" data-url="https://www.aras.com/community/cfs-file/__key/system/emoji/1f60a.svg" title="Blush"&gt;&amp;#x1f60a;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In this case you are right with your linked forum topic. The use case is quite similar. But I don&amp;acute;t want to stream a file from an external location. I just want to access a file, that is already available in Innovators own file vault. So I don&amp;acute;t think it&amp;acute;s very efficient to use a REST connection just to access data that the user already can access.&lt;/p&gt;
&lt;p&gt;This is my latest idea:&lt;/p&gt;
&lt;p&gt;var fileId = document.thisItem.getProperty(&amp;quot;native_file&amp;quot;);&lt;br /&gt;var fileDownloadUrl = aras.IomInnovator.getFileUrl(fileId , aras.Enums.UrlType.SecurityToken);&lt;br /&gt;var request = new XMLHttpRequest();&lt;br /&gt;request.open(&amp;#39;GET&amp;#39;, fileDownloadUrl, true);&lt;br /&gt;request.send(null);&lt;br /&gt;request.onreadystatechange = function () {&lt;br /&gt;&amp;nbsp; &amp;nbsp; if (request.readyState === 4 &amp;amp;&amp;amp; request.status === 200) {&lt;br /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var type = request.getResponseHeader(&amp;#39;Content-Type&amp;#39;);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (type.indexOf(&amp;quot;text&amp;quot;) !== 1) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(request.responseText);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;In this sample I create a temporary file download link and then read the file content from the link. But I am not sure if this one is&amp;nbsp;a recommended way to solve this task.&lt;/p&gt;
&lt;p&gt;Would be happy if somebody knows a more straight and lean variant.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to fetch file object of vaulted File with JS so we can later read the file content?</title><link>https://www.aras.com/community/thread/4469?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 14:08:09 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:d4bd1a9d-3c68-4ca7-a83c-421bd35dc1c2</guid><dc:creator>cogres</dc:creator><description>&lt;p&gt;Hi Angela!&lt;br /&gt;&lt;br /&gt;Didn&amp;#39;t you yourself answer a similar question in &lt;a href="/f/development/3821/access-file-content-as-stream-from-a-client-js-method"&gt;this blog post&lt;/a&gt;? It would mean relying on the Aras REST API instead of using JS IOM, though.&lt;br /&gt;Or did I misunderstand the question?&lt;br /&gt;&lt;br /&gt;Cheers,&lt;/p&gt;
&lt;p&gt;C&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>