New Incoming Email NotesID or UID

Hi! I write an agent to trigger after new email arrive trigger for notification purpose. But i don’t know how to use lotus script to get the new arrive email notesID or UID when the event is trigger? Please provide a sample, thanks!

Subject: New Incoming Email NotesID or UID

Try the Session.DocumentContext object. this is the NotesDocument object of the email you recieved

Subject: RE: New Incoming Email NotesID or UID

Hi! Thanks for response, i has try use the session documentContext but it return object variable not set, below is the code that i use to try for (After mail arriveds event), please comment. Thanks!

Sub Initialize

Dim session As NotesSession 

Dim docIn As NotesDocument 

Dim db As NotesDatabase 

On Error Goto ErrProcess

Set session = New NotesSession

Set db=session.CurrentDatabase

Set docIn=session.DocumentContext

clientAddress = docIn.From(0)

clientSubject = docIn.Subject(0)

Msgbox clientsubject

Exit Sub

ErrProcess:

Print "Error " & Err() & ": " & Error()

End Sub

Subject: RE: New Incoming Email NotesID or UID

Elvin,

I have commented your code below.

Dim session As NotesSession

Dim docIn As NotesDocument

Dim db As NotesDatabase

On Error Goto ErrProcess

Set session = New NotesSession

Set db=session.CurrentDatabase

’ The docln document referrs to nothing. It is not a part of a collection, or view. You need to either search for the document or get it out of a View.

Set docIn=session.DocumentContext

clientAddress = docIn.From(0)

clientSubject = docIn.Subject(0)

Msgbox clientsubject

Exit Sub

ErrProcess: Print "Error " & Err() & ": " & Error()

End Sub