On 27 Nov 2014 at 14:37:50, Adrien Moi
(adrienmoi1988@hotmail.com(mailto:adrienmoi1988@hotmail.com)) wrote:
Hello
In a groovy macro I can access the comments on the page like this :
comments = doc.getComments();
now I want to delete the last one... how can I do that?
I tried :
comments[0].delete();
but it doesn't work....
do you know what to type to make it work?
You can get the xobjects of type XWiki.XWikiComments and remove the last one.
Check $doc in the SRD. Something like $doc.getObjects(“XWiki.XWikiComments”) and then
$doc.removeObject(objct).
And don’t forget to save the doc in the end: $doc.save(…).
Would be interesting to have a code snippet on
extensions.xwiki.org showing this…
Thanks
-Vincent
Thanks a lot
Adrien