cogProgrammatically delete an attachment from a document
Developed by

Oana Florea

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Programming rights are needed in order to use deleteAttachment
#set ($myDoc = $xwiki.getDocument('Space.Document'))
#set ($attachmentName = 'myattachment.txt') ## delete the attachment with this name
#if ($myDoc.getAttachment($attachmentName))
  $myDoc.document.deleteAttachment($myDoc.getAttachment($attachmentName).attachment, $xcontext)
  $myDoc.save()
#end

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Tags: development
Created by ElenaOanaTabaranu on 2009/07/08 18:43
     

Get Connected