Find all files in a site with Alfresco 4.1 webscripts

眉间皱痕 提交于 2019-12-06 16:10:59

I would write a recursive function to traverse the folder hiarchy, something like this:

var documentLibrary = companyhome.childByNamePath("sites/foo/documentLibrary");

var children = documentLibrary.children;

traverse(children);

function traverse(nodes){
  for each(var node in nodes) {
    if (node.isContainer){
      logger.log(node.name + " is a folder, traversing down");
      traverse(node.children);
    }else {
      logger.log(node.name + "is a document, modified: " +     node.properties["cm:modified"]); 
    }
  }
}

It's quite simple actually. If you look in the code of the docsummary dashlet/js file (Recently Modified Dashlet), you'll see that it's firing:

slingshot/doclib/doclist/documents/site/" + Alfresco.constants.SITE + "/documentLibrary?max=50

So you only need is a list of sites available and good for you that there is a service for it listSites(nameFilter, sitePresetFilter) .

You can just use listSites(null, null), which will return all sites. So just loop through the sites and fire the webscript.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!