<?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 how to find documentLibrary using childByNamePath in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/how-to-find-documentlibrary-using-childbynamepath/m-p/290403#M243533</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to populate the documentLibrary section of a new site using some javascript like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;javascript&amp;gt;sourceNode.copy(document.childByNamePath("documentLibrary"), true);&amp;lt;/javascript&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;where document is the new site.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This statement always errors though giving this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;Destination Node is a mandatory parameter&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but yet when I copy to the document root it works like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;javascript&amp;gt;sourceNode.copy(document, true);&amp;lt;/javascript&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why cannot it find the documentLibrary node?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;More info:&amp;nbsp; I'm triggering this script from a rule on the Sites directory.&amp;nbsp; I'm wondering if there is a race condition where the site gets created under Sites but does not yet have it's documentLibrary node.&amp;nbsp; That would cause what I'm seeing if this can happen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE2:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes something like this is happening because document.children is empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I don't fire the rule the site gets created just fine and has a documentLibrary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Why doesn't the site have all its children such as the documentLibrary when it first gets placed under Sites?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Jan 2014 01:18:42 GMT</pubDate>
    <dc:creator>gerryr</dc:creator>
    <dc:date>2014-01-14T01:18:42Z</dc:date>
    <item>
      <title>how to find documentLibrary using childByNamePath</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-find-documentlibrary-using-childbynamepath/m-p/290403#M243533</link>
      <description>I'm trying to populate the documentLibrary section of a new site using some javascript like this:&amp;lt;javascript&amp;gt;sourceNode.copy(document.childByNamePath("documentLibrary"), true);&amp;lt;/javascript&amp;gt;where document is the new site.This statement always errors though giving this error&lt;IMG id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://migration33.stage.lithium.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;estination No</description>
      <pubDate>Tue, 14 Jan 2014 01:18:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-find-documentlibrary-using-childbynamepath/m-p/290403#M243533</guid>
      <dc:creator>gerryr</dc:creator>
      <dc:date>2014-01-14T01:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to find documentLibrary using childByNamePath</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-find-documentlibrary-using-childbynamepath/m-p/290404#M243534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Because containers for tools don't get created until the tool is used the first time. It is the same reason there is not a wiki, discussion, or calendar folder when the site gets created.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The workaround is simple though. Modify your script to check to see if the documentLibrary node exists. If it does not, just create it. You can look up an existing documentLibrary folder in the node browser to make sure you get the type and name exactly right.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 15:22:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-find-documentlibrary-using-childbynamepath/m-p/290404#M243534</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2014-01-14T15:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to find documentLibrary using childByNamePath</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-find-documentlibrary-using-childbynamepath/m-p/290405#M243535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, Jeff.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll create the necessary nodes in my script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 15:34:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-find-documentlibrary-using-childbynamepath/m-p/290405#M243535</guid>
      <dc:creator>gerryr</dc:creator>
      <dc:date>2014-01-14T15:34:14Z</dc:date>
    </item>
  </channel>
</rss>

