I have been asked to run an agent on the event “After new mail arrives”, and i’m extracting data from the mail to fill a form. The problem arrises when i try to extract an attachment which comes in the mail and try to put it in a richtext field already created in the form.please help
Subject: Attachment Problem
What is the problem that you get?
Mike
Subject: RE: Attachment Problem
With the EmbeddedObjects property i cannot copy the attached file, i can only extract it to a particular location. But as this agent will run on server(Linux) i’m not able to extract the attachment and save it. So the only option i have is to directly copy the attachment into the richtext field. Whenever i’m trying to do it, i’m not getting the file but only getting the file name
Soumyajit…
Subject: RE: Attachment Problem
Why can’t you extract it? Linux allows files to be saved, just like other operating systems, and “running on server” is not a particularly good excuse – you only need access to the temp directory.
Subject: RE: Attachment Problem
Dear Soumyajit,Create a directory in server which will hol you files temporarily.Give ageent full administration rights in properties and its second tab.
Now execute the code as following
Dim inputAttachment As NotesEmbeddedObject
Dim richTextatch As New NotesRichTextItem(Doc, "Bodyforattach")
Dim itemAtch As NotesItem
Forall s In maildoc.Items
If s.Name = "$FILE" Then
Set itemAtch = s
fileName = itemAtch.Values(0)
Set inputAttachment = currdoc.GetAttachment ( fileName )
tempDirectory = ses.GetEnvironmentString ( "Directory", True )
filePath = tempDirectory + "\" + fileName
Call inputAttachment.ExtractFile ( filePath )
Set inputAttachment = richTextatch.EmbedObject ( EMBED_ATTACHMENT, "", FilePath )
Kill FilePath
End If
End Forall
MOdify variables accordingly
Manu
Subject: RE: Attachment Problem
Dear Manu
Thanks a lot.
Soumyajit.