I am hoping someone can help me out. I’m not a developer but I’ve been asked to create an agent to delete documents on a certain date (5/31/xx) each year. I have NO idea how to make that work. I’ve created a view from which the documents will be deleted and that’s as far as I got. I’ve looked around for something to copy but haven’t found anything. ANY and ALL help is extremely appreciated.
Subject: Try this
Hello,
If you want to delete all the documents from that view, put this code in your agent:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim vc As NotesViewEntryCollection
Set db = session.CurrentDatabase
Set view = db.GetView(“DocsToDelete”) 'replace this with the name of your view
Set vc = view.Allentries
Call vc.RemoveAll(True)
If you only need to remove some documents from the view try:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim vc As NotesViewEntryCollection
Set db = session.CurrentDatabase
Set view = db.GetView(“DocsToDelete”) 'replace this with the name of your view
Set vc = view.GetAllEntriesByKey(“myKey”) 'replace this with your search key
Call vc.RemoveAll(True)
Also check the Domino Designer Help file, you find examples there for the things you need
Subject: Thanks but…
I have the part where it deletes the docs n the view. What I don’t know how to do is put a check in there for the date…I want the agent to run every day but not delete documents until 5/31 of each year…
Subject: test for date
why run it daily if it is not doing anything except on 5/31? I am assuming it is doing something else on the other dates as well? What I think you want to do is test for the current month and day. (Not the whole date/time, as you want it to run on 5/31 regardless of year or time.) So maybe somethign like:
if month(today) = 5 then
if day(today) = 31 then
>put your script here<
end if
end if
Subject: Or just make it a scheduled agent