Q

Reply to e-mail with history & without attachments

This Content Component encountered an error
Is there an easy way to reply to an e-mail with history, but without any attachments? This would also apply to "reply with history to all" e-mails.

View member feedback to this Ask the Expert Q&A.

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

MEMBER FEEDBACK TO THIS ASK THE EXPERT Q&A:

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.

—Brian P.

Do you have comments on this Ask the Expert question and response? Let us know.

This was first published in March 2005

Dig deeper on Lotus Notes Domino Application Development

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close