Hi,I am a newbie to alfresco. I have created a sample wcm project and want to create a web script that will return me the contents of a specified file.I saw an example in the forum for the same that returned the contents of a file in Guest Home. Now when i try to access the files in my web project i can either1) Traverse the node via the path.The script for that I used for accessing the file Guest Home directory is :
var data = companyhome.childByNamePath("/Guest Home/a.xml");
if(data == null ){
logger.log("No files found");
status.code = 404;
status.message = "No files found";
status.redirect = true;
} else {
model.storeid = data.getId();
model.dataRetrieved = data;
}
2)The second way could be performing a lucene search for the ID of that file.The code for the same is:
var files = search.luceneSearch("ID:\"workspace://SpacesStore/0d18339a-1c6e-4b92-975f-1d9004e96264\"");
if (files == null || files.length == 0) {
logger.log("No files found");
status.code = 404;
status.message = "No files found";
status.redirect = true;
} else {
var data = files[0];
model.storeid = data.getId();
model.dataRetrieved = data;
}
Now both the codes work fine for the file in the guest home directory.But when i try to perform a lucene search for a file in my wcm directory (again with the help of its storeid), it gives me no file found and i have no idea how to get the name path for that particular file!!!!!Please help!!!!!!!!