cancel
Showing results for 
Search instead for 
Did you mean: 

Simple search script

billmce
Champ in-the-making
Champ in-the-making
I'm trying to learn web scripting. 
I've bought two Alfresco books. I can't get the examples in either book to work. Very frustrating. Time vampire.

If anyone has a simple web script(s) they're willing to share I'd very much appreciate it.
I'm trying to:
a) List files in the repository.
b) Search files in the repository.
c) Upload files to the repository.

Simple stuff (I thought, but I've been unsuccessful).

Thanks in advance.
3 REPLIES 3

krishr
Champ in-the-making
Champ in-the-making
Hi,

the link has info on creating web scripts to browse a folder to list contents and file upload

http://wiki.alfresco.com/wiki/Web_Scripts_Examples#

3. Folder Browse/RSS feed
7. File Upload

regards,
Raghu.

zaizi
Champ in-the-making
Champ in-the-making
Alfresco loads of webscripts available OOTB: Check http://localhost:8080/alfresco/service/index for full list.

lucille_arkenst
Champ in-the-making
Champ in-the-making
I found this post to be very useful: http://forums.alfresco.com/en/viewtopic.php?f=36&t=10481 

I also bought two books… and experienced the same frustrations.  I know what you're going through! 
The wikis are good, but I didn't feel that they sufficiently explain what parameters need to be sent to search.luceneSearch("…")
For example, your path to Company Home should be "app:company_home".  Sites needs to be "st:sites".  (I stumbled across this piece of information in one of the forums somebody said PATH:\"/app:company_home/st:sites.)  And documentLibrary has to be cm:documentLibrary.  So if you are searching for a particular space, your search would look something like this:

var RM_PATH = 'PATH:"/app:company_home/st:sites/cm:myCustomSpace/cm:documentLibrary//*"'
var query = RM_PATH + ' AND @cm\\:name:\"' + spaceName + '\"';
var results = search.luceneSearch(query);

Hope that helps.  Good luck!