cancel
Showing results for 
Search instead for 
Did you mean: 

How to Get the NodeRef of the Opened Document in Alfresco Share

kdkanishka
Champ in-the-making
Champ in-the-making
Hello Dudes,
I am planning to generate direct download link from the client side when user open a document in document details window. In order to do that I want to access noderef of the opened document. Can someone mention how to access noderef of the opened document from alfresco share client side (javascript).
2 REPLIES 2

zladuric
Champ on-the-rise
Champ on-the-rise
You need a direct download link, but there is one already, in the Document Actions component? It looks something like this:

http://dev:8080/share/proxy/alfresco/api/node/content/workspace/SpacesStore/d270106f-a784-4624-8b7d-...

Also, it depends in which component you want this. Ie. Alfresco.DocumentMetadata client-side component, or WebPreview, they already have this in
this.options.nodeRef
. If you're building a custom Javascript module, you could also set this from the server side controller - take a look at how the two components I mentioned above do that.

Other then that, you can simply use pure javascript. Ie. you can use
window.location.search>
. It will give you something like
"?nodeRef=workspace://SpacesStore/d270106f-a784-4624-8b7d-8a3e0feecf22"
so you can parse the nodeRef from that in plain Javascript.

kdkanishka
Champ in-the-making
Champ in-the-making
Thanks it was very helpful.