In Groovy, you should take a look at the other binding API like `xwiki` in order
to get a document. `xwiki`gives you an object of type
`com.xpn.xwiki.api.XWiki`; this object has a `getDocument` method (you can find
these informations in the API documentation [1]).
For the use of this `getDocument`, you probably want to use references with
`service.model` binding API.
To resume in your example (not tested, just from memory)
{{groovy}}
def yourDocReference = service.model.createDocumentReference('xwiki', 'XWiki',
'WebHome')
def yourDoc = xwiki.getDocument(yourDocReference)
def list = yourDoc.getAttachmentList()
{{/groovy}}
Hope this helps
-----
[1] http://platform.xwiki.org/xwiki/bin/view/DevGuide/API
On Mon, Nov 10, 2014 at 04:02:32PM +0100, Adrien Moi wrote:
> Hello
>
> I have a little question and I couldn't find an answer on the internet...
>
> In a groovy part, I can create list the attachments of the current document
> with this :
> {{groovy}}
> list = doc.getAttachmentList();
> print(list);
> {{/groovy}}
>
> how can I access the documents of another page in the same way?
> On a different page of the wiki I tried
> {{groovy}}
> list = XWiki.WebHome.getAttachmentList();
> print(list);
> {{/groovy}}
> to get a list of the attachments on XWiki.WebHome, but it didn't work...
>
> Do you have any clue?
>
> Thank you very much !
>
> Adrien
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
--
Jean Simard
[email protected]
Research engineer at XWiki SAS
http://www.xwiki.com
Committer on the XWiki.org project
http://www.xwiki.org
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users