I have an incoming email (mail-in db) that contains a RichTextField where "some" attachments are found. I am also finding attachments not in the RTF but in the Document as $FILE. I am trying to get a handle on all the objects to copy them to another outgoing email. I can find the $FILE using the code below.
Dim rtiObject as NotesEmbeddedObject
Dim rti_Email as NotesRichTextItem
Dim obj_Email as NotesEmbeddedObject
ForAll p in mailDoc.items
if p.Name = "$FILE" then
set obj_Email = mailDoc.GetAttachment(p.Values(0)) 'this will return the Name of the attachment (or file)
set rtiObject = rti_Email.EmbedObject( EMBED_ATTACHMENT, "", obj_Email.Name) 'this is supposed to attach the file to the document's RTF
End If
End ForAll
When this script runs it finds the $FILE files and returns the name but not the object and I cannot do anything with it from there.
What do I need to do to get the attachment/object ($FILE) from the original doc and attach it to an RTF in the outgoing email?
I thought about detaching the attachment to the network and then attaching it to the outgoing email and then deleting the attachment from the network but that seems impractical.
Is there a better way to handle these $FILE type of attachments on the incoming email that would make this easier?
Try the EmbeddedObjects
property of the NotesDocument
object. Something like this:
Forall obj_Email in MailDoc.EmbeddedObjects
If obj_Email.Type = EMBED_ATTACHMENT then
Call obj_Email.Extract(sometempdirectory$ & obj_Email.Name)
Call rti_Email.EmbedObject(EMBED_ATTACHMENT, "", sometempdirectory$ & obj_Email.Name)
End Forall
You can also do it without detaching if you wish.