Link to home
Start Free TrialLog in
Avatar of umapada
umapada

asked on

DocumenContext fails

Hi,
I am trying to capture the contents of a mail. SO I have created an agent(shared agent) (After new mail has arrived).
But after debugging I have found that :
     Set doc = session.DocumentContext
     Ifrom = doc.from(0) ----> fails ??? Any reason
I have tried an alternate ways bu still fails :
Set it = doc.GetFirstItem("Subject")
but it also fails.
Here is the detail code :
-----------
Sub Initialize
     Dim session As NotesSession
     Set session = New NotesSession
     Dim db As NotesDatabase
     Dim doc As NotesDocument
     Dim dbug As NotesLog
     Dim rtitem As Variant
     Dim fileCount As Integer
     Dim it As NotesItem
     Dim user As String
'     REM get the incoming mail message
     Set doc = session.documentcontext
'REM Specify the size limit for attachments
     Const MaxSize = 0
     fileCount = 0
     Set dbug = New NotesLog("Router log")
     dbug.LogActions = True
     dbug.OpenAgentLog
     dbug.LogAction("begin")
     
     
     Open "c:\\umapada" & FileName & ".txt" For Output As #1
'REM Log the subject name of the message for debug purposes
     user = session.CommonUserName
     Set doc = session.DocumentContext
     Ifrom = doc.from(0)   ' this  fails  ..any reason
     dbug.LogAction("umapada" )
     Set it = doc.GetFirstItem("Subject")
     Write #1, "Subject "
     Write #1,it.Text
     Write#1,"****************************************************************************"
     dbug.LogAction("doc subject from context" + "-> " + it.Text)
     Set rtitem = doc.GetFirstItem( "Body" )
     Write #1, "Body"
     Write #1, rtitem.Text
     Write #1,"****************************************************************************"
     dbug.LogAction("Mail preprocessing agent is done")
     dbug.Close
End Sub



-----------

Any comment will be highly appreciated.

thanks in advance,
umapada
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of snocross
snocross

What do you mean by 'it fails'?  When you step through in debug mode and you reach that line of code what happens?  Does the code stop working and display an error or do you just find that the IForm value appears to be null?
... I meant 'IFrom' by the way....
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey Zvo-Bro & Sno-Bro !

Yet again I excelled in stealing from my bro!

Sorry buddy...I could not resist it.

;-)
Arun, not sure of which question you are refering to.
He is hoping to get this one :-)
Sh!t Thief!!!
He managed again to steal 100 of mines and 100 of Heman's points!!!

Ok ok, congrats' Bro :-)

I'm confused.
Look at the previously answered question.  The title of the question says "Points for Zvonko" LOL !!!

I didn't try to steal Hemans points by the way...

:-)
So it's special honor to be stolen by Bro!

Thanks, I will do you the same :-)

As you see i am no longer actively participating here at EE.  Even if you steal it will be an honor for me !
Yes, I see, and I am sad about it Bro, really.
Just few days ago I got my cable modem and flat rate. Now we could chat anytime here. Instead of chatting I have to answer questions like this one! Why do I not get my email document here and not there and so on. And he is not even interested in his/her question. Afterwards he/she grades a B and says "thanks" :(
Avatar of umapada

ASKER

Thanks scottrma ,
 I have got ur points.


regards,
umapada
...or he/she even don't talk to you :-)