Dear all, Does anyone know how to get the attachment in notes mail and copy it into notes document. I noticed that the attachment is in the field named “$File”, and I tried to get the attachment and copy it into notes document using the method below, but this doesn’t work.
Dim itemA As NotesItem
itemA=docCurrent.getfirstitem("$File")
Call newdoc.Copyitem(ItemA, "Body")
So, can anyone pls give some advice on this problem ?
Subject: RE: Get attachment from notes mail and transfer notes document
Dear Joe Nelson,
I have tried the script that u posted to me, but it occurs "Type Mismatch" problem on this line :
"Forall o In rtitem.EmbeddedObjects"
Below is my full script (in a button), can you please check what caused the problem to occur? I have tried to define the rtitem to NotesRichTextItem also doesn't solve the problem.
Thanks in advance.
Dim ws As New NotesUIWorkspace
Dim ss As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim docCurrent, memo As NotesDocument
Dim rtitem As Variant
Dim object2 As NotesEmbeddedObject
Set db=ss.CurrentDatabase
Svr$=db.Server
Dim docDialog As New NotesDocument(db)
Set fdb=ss.Getdatabase(Svr$, "Notes Application\PCSPFS.nsf")
Set uidoc=ws.CurrentDocument
Set docCurrent=uidoc.Document
Call ws.DialogBox("Dialog Box for Mail Transfer", True, True, False, False, False, False, "Project Info", docDialog)
docCurrent.Jobname=docDialog.Jobname(0)
Set memo=fdb.CreateDocument
memo.Form="Memo"
Set rtitem=docCurrent.getfirstitem("Body")
If (rtitem.Type=RICHTEXT) Then
Forall o In rtitem.EmbeddedObjects
If (o.Type=EMBED_ATTACHMENT) Then
Call o.ExtractFile("c:\My Documents\" & o.Source)
End If
Set rtitem2= New NotesRichTextItem( memo, "Body" )
Set object2=rtitem2.EmbedObject(EMBED_ATTACHMENT, "", "c:\My Documents\" & o.Source)
End Forall
End If
Call memo.replaceitemvalue("Jobname", docCurrent.Jobname(0))
Call memo.Save(True, False)