<?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 move files -javascript in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268314#M221444</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to move a document to a destination folder using javascript API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is if the document with same name already exists in the repository, the move does not work and throws error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is there any way i can overwrite the document if it already exists through move api?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;here is my code&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var rootSpaceName = companyhome.childByNamePath("nodename"); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var childList = rootSpaceName.children;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var count = childList.length;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var test = new Array();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for(var i=0; i&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{ &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var childName = childList&lt;/SPAN&gt;&lt;EM&gt;.properties.name;&lt;BR /&gt;var child = childList&lt;EM&gt;;&lt;BR /&gt;&lt;BR /&gt;if(!child.isContainer)&lt;BR /&gt;{&lt;BR /&gt;var newSpace = childName.substring(0,4);&lt;BR /&gt;var ind = 0;&lt;BR /&gt;&lt;BR /&gt;var existingSpace = rootSpaceName.childByNamePath(newSpace);&lt;BR /&gt;&lt;SPAN style="color:#400040;"&gt;&lt;STRONG&gt;child.move(existingSpace)&lt;/STRONG&gt; // this code fails if the document with same name already exists in the space&lt;/SPAN&gt;&lt;BR /&gt;}&lt;/EM&gt;&lt;/EM&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Oct 2012 03:37:46 GMT</pubDate>
    <dc:creator>meethrishi</dc:creator>
    <dc:date>2012-10-05T03:37:46Z</dc:date>
    <item>
      <title>move files -javascript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268314#M221444</link>
      <description>I am trying to move a document to a destination folder using javascript API.The problem is if the document with same name already exists in the repository, the move does not work and throws error.is there any way i can overwrite the document if it already exists through move api?here is my codevar r</description>
      <pubDate>Fri, 05 Oct 2012 03:37:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268314#M221444</guid>
      <dc:creator>meethrishi</dc:creator>
      <dc:date>2012-10-05T03:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: move files -javascript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268315#M221445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can just check that if file exist delete the existing file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;add these piece of code &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//check and remove existing file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; var existing_file=existingSpace.childByNamePath(child.name);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(existing_file!=null)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { existing_file.remove();}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;before this line&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;child.move(existingSpace)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Oct 2012 07:37:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268315#M221445</guid>
      <dc:creator>mitpatoliya</dc:creator>
      <dc:date>2012-10-05T07:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: move files -javascript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268316#M221446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thanks but unfortunately i can not do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if i delete then all the existing metadata and aspects of that file will be removed when i delete the file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and the files that i am working with are PDFs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Oct 2012 08:31:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268316#M221446</guid>
      <dc:creator>meethrishi</dc:creator>
      <dc:date>2012-10-05T08:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: move files -javascript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268317#M221447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You don't want to be using move then!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sounds like you should be copying your node if target does not exist.&amp;nbsp; Else just updating the content in your target node.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Oct 2012 08:34:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268317#M221447</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2012-10-05T08:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: move files -javascript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268318#M221448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;correct but updating content if its text file is easy. if the files are PDF, how can i ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Oct 2012 08:46:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/move-files-javascript/m-p/268318#M221448</guid>
      <dc:creator>meethrishi</dc:creator>
      <dc:date>2012-10-05T08:46:34Z</dc:date>
    </item>
  </channel>
</rss>

