On 27 Nov 2014 at 14:51:40, vinc...@massol.net (vinc...@massol.net(mailto:vinc...@massol.net)) wrote:
> > > > > > On 27 Nov 2014 at 14:37:50, Adrien Moi > (adrienmoi1...@hotmail.com(mailto:adrienmoi1...@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(http://extensions.xwiki.org) showing this… You can also check these examples: http://extensions.xwiki.org/xwiki/bin/view/Main/Tags?do=viewTag&tag=comments Thanks -Vincent > Thanks > -Vincent > > > Thanks a lot > > Adrien _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users