How to delete a file using SSJS in XPages

It’s easy to do file deletion operation using class because the class provides us a delete() method, but unfortunately you can’t use that method inside Domino Designer’s SSJS editor, you will get a syntax error if you try to do so.

So, here’s a workaround (credited to Mark Leusink) I put here for my own reference

var = new "path" );
var deleteMethod = f.getClass().getDeclaredMethod("delete", null);
deleteMethod.invoke( f , new java.lang.Object[0] );

Leave a Comment

Your email address will not be published. Required fields are marked *