Ways to find the node ids of a content in Alfresco

Ways to find the node ids of a content in Alfresco

It is a common need when working with Alfresco to find a contents node id for multiple reasons. If you are naïve or medium level techie person follow below notes to find a contents node id.
Ways,
From Alfresco Explorer
From Alfresco Share
By Javascript code,
By Alfresco SDK

From Alfresco Explorer
Hover the content
Hovering the content item in Alfresco displays its target url embedded with a servlet with its node id. Check lower left corner of your browser.. (I use google Chrome!?). Copy the target url and paste it in a notepad to make it how you want..



The same can be found in download link of the content and few of the other actions associated with it
Node Browser
Click on the Administration Console button in your Alfresco Explorer on which you can find Node Browser option.

Selecting the corresponding stores, you will be listed with contents(or Alfresco nodes) along with their node details.


Alfresco Share
Hover works with Share too but only has got a slightly different url mix up. Copy the target url and paste it in a notepad to make it how you want..



The same can be found in download link of the content and few of the other actions associated with it
Navigate to the desired content to get its detail.



Javascript API

Scriptnode holds a property “id” for storing the node id of an alfresco node.
 var name1 = userhome.properties.id
 var name2 = userhome.properties["id"];
 var name3 = userhome.properties["cm:id"];
 var name4 = userhome.properties["{http://www.alfresco.org/model/content/1.0}id"];

Any many API calls returns such nodes which can be iterated and accessed like above.
Query
var newquery = "PATH:\""+ result3 + "//*\" AND @cm\\:name:\"" +model.node.name +"\"";
model.result = newquery;
var nodes = search.luceneSearch(newquery);


Alfresco SDK
The class NodeRef holds the detail of nodes. Many SDK calls returns NodeRef or its array as response. Iterate over it and fetch the node.id


for (NodeRef node : nodes)
{..}

Share this

Related Posts

Previous
Next Post »