AnsweredAssumed Answered

Freemarker script: retrieve the content of a space

Question asked by theorbix on Apr 16, 2008
Latest reply on May 14, 2008 by poptarts
Hello,

I'm writing a .ftl script that should retrieve the content of a certain Space.

<!– Search a given space by its unique node ID –>
<#assign folderID = companyhome.childrenByLuceneSearch["ID:workspace\\:\\/\\/SpacesStore\\/2f93b4a6-f609-11dc-a589-999071556af1"] />
<#list folderID as child>
   <#assign folderContent = child.children />
</#list>

<!– Display all documents in the space –>

<script>var AlfNodeInfoMgr = new Alfresco.PanelManager("NodeInfoBean.sendNodeInfo", "noderef");</script>
<table class="recordSet" width=100%>
   <thead>
      …
   </thead>
  
   <tbody>
      <#list folderContent as child>
          …..
      </#list>
   </tbody>
   </table>

Now I need to add a test to see if the query has found the Space or not (in case the node ID is invalid, the script would crash with the folowing error message: "An error occurred in one of the dashlets.
Error during processing of the template 'Expression folderContent is undefined on line 24, column 14 in alfresco/templates/foldercontent1.ftl.'. Please contact your system administrator.").

How can I add such a test in the script?

Outcomes