cancel
Showing results for 
Search instead for 
Did you mean: 

Getting all nodes of a given type

itrub
Champ in-the-making
Champ in-the-making
Dear colleagues
I want to get all nodes of a given type (not in given folder, but of a given type across al folders!), then to iterate it programmatically and to analyze value of some property for each document? Could you hint me piece of code, that do it or to give useful reference? Thanks in advance. I can not find example in manuals.
Sincerely, Iliya
4 REPLIES 4

loftux
Star Contributor
Star Contributor

itrub
Champ in-the-making
Champ in-the-making
Dear Loftux
Many thanks for your answer. But I need some refinement. Script, that you have referenced, take as "space"-value the current space, it was started from. I want to pass "space" to function explicitly, as parameter. How I can do that? Could you give some examples of calling codestring of this script with parameter, for example, from "Company Home" or some custom folder. Thanks in advance.
Sincerely, Iliya

itrub
Champ in-the-making
Champ in-the-making
May be, somebody knows how to solve that problem on Java, not on JavaScript. But, if not, I shall forced to use javascript, this is not fatal problem.

loftux
Star Contributor
Star Contributor
Just modify the code and pass in the starting node
var mystartnode = utils.getNodeFromString(noderef) ;
where noderef is a string of the noderef
or you can do
var mystartnode = companyhome.childByNamePath (string path);

Then call
update(mystartnode);

http://wiki.alfresco.com/wiki/3.4_JavaScript_API

And I'm not insisting you do this in javascript, just happened to have an example for that.