Ask the Expert

Reply to e-mail with history & without attachments

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: