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.

Lotus notes domino

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] );


Related posts:


About number.0