How to delete documents from view
Posted on 2009-04-30
I'm not a Lotus Notes expert, so forgive any misuse of terminology
I'm hoping this isnt too complicated, but I've oodles of question points available to spend on it if it does...
I have a domino database that receives messages daily from lots of different sources, and an agent that identified the ones Im looking for, and puts them into a view.
I want to scan the view, keep the latest document from each source (its a unique document subject), and delete all older copies.
I've written some code (Perl) that uses the Notes.NotesSession object to:
Open the view
Create a viewnavigator
and loop through each document via ViewEntry ->GetNextDocument, so I can extract all the details I need.
I intend to compare (for each document subject) the posted date in order to determine the one I need to keep, and mark the 'other' one for deletion.
This could be either from either the current viewentry I have, or the one I've stored previously.
I've got it happily printing out what its doing, what records its looking at, and identifying the correct ones to delete, but haven't got it yet actually doing it
I dont have any problems with the coding, but I dont understand the Domino COM implementation well enough to know if:
1. is this an acceptable way to do it?
2. Is there a way to order the documents in the viewnavigator so I get the newly posted ones first?
3. If I need to delete a previously 'stored' document reference - what would I need to store in order to retrieve it, and do the deletions affect the viewnavigator.
any advice or code snippets appreciated - I dont mind what language they come in!
hope this makes sense....