Hi!
Glad you like the videos. Thanks!
Below is some code from the help database. I think you can safely ignore the loop as that's just populating the collection rather then getting a document by key.
Suggestion after you get your collection with:
collect:NotesDocumentCollection = myView.getAllDocumentsByKey(key, true) // Out put the collection count to the log to make sure that we have documents.
print(collect. getCount()) collect.removeAll() |
That really should do it. Are you sure that you're doing it under an account that actually HAS delete access? Is there an error message? Don't forget to go into application properties and click on for the runtime error thing. That should give you more detail then the Error 500.
Try that and see if either of those options work. the really should assuming you have ACL delete access. If not I'll try and put a demo together for notesin9.com / xpages.tv.
Dave
==== From Help DB ====
var dc:NotesDocumentCollection = database.createDocumentCollection();
var view:NotesView = database.getView("main");
var doc:NotesDocument = view.getFirstDocument();
while (doc != null) {
if (doc.getItemValueString("subject").endsWithIgnoreCase("obsolete")) {
dc.addDocument(doc);
}
doc = view.getNextDocument(doc);
}
requestScope.status = "Number of documents removed: " + dc.getCount();
dc.removeAll(true);