Get a handle to the document you want to reply to and delete any attachments (don't save the document) then create the response. Some sample code follows.
Set db = session.currentDatabase Set docProfile = db.GetProfileDocument ("ReplyProfile") Set doc = session.DocumentContext Set uidoc = ws.EditDocument(False, doc) Set doc = uidoc.document Call uidoc.close strErrMsg = "Memo format prevents the attachment(s) from being removed." intReplyToAll = (docProfile.Action(0) = "ReplyToAll") intStandardReply = True If doc.HasEmbedded = True Then Set item=doc.getFirstItem("body") If (item Is Nothing) Then Messagebox strErrMsg, MB_ICONEXCLAMATION, "Cannot Remove Attachment (s)." Else If Isempty(item.embeddedObjects) Then Messagebox strErrMsg, MB_ICONEXCLAMATION, "Cannot Remove Attachment(s)." Else Forall x In item.embeddedObjects If x.type = EMBED_ATTACHMENT Then 'is there an attachment intStandardReply = False Exit Forall End If End Forall End If End If End If If intStandardReply Then 'do a normal reply with history If intReplyToAll Then Call session.SetEnvironmentVar( "MailStEd", "9" ) End If Call ws.ComposeDocument ("","","Reply With History") Else 'get rid of attachments from background document Set tempdoc = New NotesDocument(db) Set item=doc.getFirstItem("body") 'Set up RichTextStyle Set richStyle = session.CreateRichTextStyle richStyle.NotesFont = FONT_HELV richStyle.FontSize = 8 richStyle.NotesColor = COLOR_DARK_MAGENTA Call item.AppendStyle(richStyle) Call item.AddNewLine(2) Call item.AddNewLine(1) Forall Attach_File In item.embeddedObjects If Attach_File.Type = EMBED_ATTACHMENT Then strFilename = Attach_File.Source Call item.Appendtext("<< Attachment Removed : " + strFilename$ + " >>") Call item.AddNewLine(1) Attach_File.Remove End If End Forall Call doc.CopyAllItems(tempdoc,True) Call tempdoc.MakeResponse( doc) Call tempdoc.Save(True,False) 'open the tempdoc using the new memo form and create a reply with history. Set tempuidoc = ws.EditDocument(True,tempdoc) If intReplyToAll Then Call session.SetEnvironmentVar( "MailStEd", "9" ) End If Set anotheruidoc = ws.ComposeDocument ("","","Reply With History") Set refitemintempdoc = tempdoc. GetFirstItem("$REF") Set refitem = refitemintempdoc. CopyItemToDocument( anotheruidoc.document,"$REF") Call tempuidoc.close Call tempdoc.Remove(True) End If
I have a much simpler solution -- upgrade to Notes 6.5. It has been out for quite some time and has this functionality built into the template.
Do you have comments on this Ask the Expert question and response? Let us know.
Related Q&A from Brian Mahoney
Find out what types of calculations can be computed for a column in a Lotus Notes view and the best way to go about it with this expert response.continue reading
Find out why you can't use Formula language to include a doclink to a specific Lotus Notes view or database and need to use LotusScript instead.continue reading
Discover the reasons behind a Notes/Domino admistrator having trouble with disabled options in the "customize this view" section of his Lotus Notes ...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.