cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing the contentUrl with Javascript

username
Champ in-the-making
Champ in-the-making
Hey,

What I'm trying to do is write a script that as part of it's functionality needs to list the actual file locations on disk of a piece of content in alfresco. When you try to access the content property, instead of the string that shows in the node browser, which is something like:

contentUrl=store://2011/7/20/17/21/82b0bc49-ef9e-4827-a673-8fcf1f66c745.bin|mimetype=application/pdf|size=33792|encoding=utf-8|locale=en_GB_

You are returned something like this:

org.alfresco.repo.jscript.ScriptNode$ScriptContentData@180ae73

Anyone know how to actually get the first string I've posted up there? I can't see anything in the API about it.

I'm on Alfresco 3.3g if that's any help.
2 REPLIES 2

craig_michael_n
Champ on-the-rise
Champ on-the-rise
what script are you trying to use?

username
Champ in-the-making
Champ in-the-making
What do you mean? It's a custom javascript script I'm writing. It could be anything, I'm just wondering how to access that particular string when accessing the content property(which is on every piece of content in alfresco).

where file is a piece of content

var doc = space.createFile("test.txt");
var c = file.properties;
for(a in c){
if(a == "{http://www.alfresco.org/model/content/1.0}content"){
doc.content += c[a];
}
}

That's just an example of what I mean. The content property will be returned as a string in this form

org.alfresco.repo.jscript.ScriptNode$ScriptContentData@180ae73

Rather than this

contentUrl=store://2011/7/20/17/21/82b0bc49-ef9e-4827-a673-8fcf1f66c745.bin|mimetype=application/pdf|size=33792|encoding=utf-8|locale=en_GB_

Which is what you see as the value of the content property in the node browser.