That's because you did not imported the class, either you use the
complete org.xwiki.model.reference.DocumentReference name, the String
based API as suggested by Marius or you import
org.xwiki.model.reference.DocumentReference at the beginning of your script.
On Mon, Nov 10, 2014 at 5:51 PM, Adrien Moi <adrienmoi1988(a)hotmail.com> wrote:
Date: Mon, 10 Nov 2014 16:23:33 +0100
From: thomas.mortagne(a)xwiki.com
To: users(a)xwiki.org
Subject: Re: [xwiki-users] access another document with groovy
def yourDocReference = new
DocumentReference('xwiki', 'XWiki', 'WebHome')
def yourDoc = xwiki.getDocument(yourDocReference)
def list = yourDoc.getAttachmentList()
I tied it on my xwiki and when I type :
{{groovy}}
def yourDocReference = new
DocumentReference('xwiki','XWiki','WebHome');
def yourDoc = xwiki.getDocument(yourDocReference);
list=yourDoc.getAttachmentList();
println(list);
{{/groovy}}
I get this error....
Caused by: javax.script.ScriptException:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1677.groovy: 1: unable to resolve class DocumentReference
@ line 1, column 24.
def yourDocReference = new
DocumentReference('xwiki','XWiki','WebHome');
did I miss anything?
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne