Before new mail arrives agent

Hi,

I am writing an agent to move incoming emails from 1:00 PM to 3:00 PM to a particular folder.

See my following code. Problem I am having is with PostedDate. As this agent is going to run on router level, I am not sure which date I can use. This agent runs fine when run manually otherwise I get error in the notes log as object variable not set. Any ideas on this ? Thank you.

Sub Initialize

Dim session As NotesSession

Dim note As NotesDocument

Dim db As NotesDatabase

Dim it As NotesItem

Dim datetime  As NotesDateTime

	

Set session = New NotesSession

Set db = session.CurrentDatabase

Set note = session.DocumentContext

Set it = note.GetFirstItem( "PostedDate" )

Set dateTime = it.DateTimeValue	



If Hour(datetime.TimeOnly)  => 13 & Hour(datetime.TimeOnly) <= 15 Then



	Call note.PutInFolder("Holdmail")

	Call note.RemoveFromFolder("$Inbox")

End If

End Sub

Subject: The problem is that the document does not have a “PostedDate” until the Router deposits the email in the file.

Since you are running before it is deposited… Why not use this instead: If Hour(Now) => 13 & Hour(Now) <= 15 Then