cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to append content

ibarbaric
Champ in-the-making
Champ in-the-making
Hello!
I want to append something to content in the most efficient way. For example, if I had a text file that contains "This is a sample content", I would like to append "…and this is appended sample content" to it.
I know: I can read content, do appending in my program and then overwrite content with the new one. However, it would improve performance (at least network traffic) if there was a special functionality in Alfresco WS API for this. Is there an alternative to read-append-overwrite scenario?
Thanks in advance!
Kind regards,
Igor
2 REPLIES 2

davidc
Star Contributor
Star Contributor
The Web Service API doesn't provide this out-of-the-box.

However, you could write a very simple Web Script http://wiki.alfresco.com/wiki/Web_Scripts that provides the required behaviour.  The Web Script just provides a public custom URL to invoke.  Within the Web Script you can Javascript to append the text…

// find the doc - from noderef or path passed on url
doc = …;

// append text
doc.content = doc.content + " some new text";

ibarbaric
Champ in-the-making
Champ in-the-making
Thanks, David!