I have a document that has an attachment.In my querysave event, I am creating a memo that will contain the document and attachment.
However, I get the error:
Can’t copy items of type ATTACHMENT or OTHEROBJECT
Any ideas - using LS - how I can get the current document and attachment(s) mailed?
Code is below:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim rt As NotesRichTextItem
Dim attachment As NotesItem
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Set maildoc = New NotesDocument(db)
Set rt = New NotesRichTextItem(maildoc, “Body”)
Set attachment = doc.GetFirstItem( “$File” )
maildoc.Form = “Memo”
maildoc.DisplaySent = “Notes Messenger”
maildoc.Subject = “Test”
maildoc.sendto=doc.GetItemValue(“forwarded_to”)
Call attachment.CopyItemToDocument(maildoc, “Body” )
Call maildoc.send(True)
End Sub
Thanks,
Tony