cancel
Showing results for 
Search instead for 
Did you mean: 

Create a link to a node (file or folder)

sergio
Champ in-the-making
Champ in-the-making
Dear WS-ers,

I have to create programmatically a link to an existing node into another node of the space. I have not yet found any documentation or useful example to solve this problem.

Is there anyone who tried and done this task succesfully?

Is there any piece of code available?

Hoping someone could help me,

best regards,

Sergio
13 REPLIES 13

jamoreno
Champ in-the-making
Champ in-the-making
is it possible to create a link to a node using Alfresco API?

Thanks

miguel_gil_mart
Champ in-the-making
Champ in-the-making
I used JavaScript to create a link to a file (photo jpg). This is the code:

var pr = [];
pr["cm:name"] = "targetName.jpg.url";
pr["cm:destination"] = "workspace://SpacesStore/76c17fe2-93f9-4293-a989-e50c4c1e01e4"; (Alfresco Target Node Reference)
pr["cm:title"] = "targetName.jpg";
pr["cm:description"] = "targetName.jpg";
linkNode = space.createNode("targetName.jpg.url", "{http://www.alfresco.org/model/application/1.0}filelink", pr);
linkNode.save();  

I hope this helps….. a couple of years late.

For, 5.2 the above code works as well.

But when deleting the destination node, the link node is not deleted. How could this be reproduced with javasctipt and createNode?

rocky
Champ in-the-making
Champ in-the-making
Hi Miguel,

I try your code, because I need to create a button in my webpage, that when clicked create a shortcut in their desktop, but I can't figured out.

I Have a FTP server that generate a link with users data to access their account, and I want when the user was created, generate a shortcut with link to the server through the explorer system, a link like this: "%windir%/explorer.exe ftp://username@ftp.server.uk//username@ftp.server.uk".

I know the users can create manually the shortcut and paste de code generated, like above, but I want avoid this work to them and they only have to click on button and save the shortcut, or automatically on desktop or they can choose the place to save the shortcut.

Is that possible?

Thanks in advance for any help.