I am trying to duplicate over the web the functionality that allows users to forward any document out of a database on a Notes Client. To do so, I have created an agent that passes the doc id of the doc needed to be forwarded to an agent, then the agent renders it to RT and mails it to the intended recipient.
The problem I am encountering is that when the email gets to the recipient inbox, it can’t be opened, and has the error “Invalid or Nonexistant Document”. Through the document properties I can see the Form field is set correctly and the Body field is rich text and contains the content I am looking for. So, the doc is being found, renderered to rt, and sent to the correct person. There are no references to external files in the content, but I cannot open the document. Note that when I send only plain text in the Body (for example “Hello World”) it works, but rendering to RT seems not to.
Any help/insight would be greatly appreciated. Below is the relevant part of the code from the agent that does the sending:
' create the doc that is being mailed
Set mailDoc = New NotesDocument(currdb)
mailDoc.Form = "Memo"
mailDoc.Subject = subject
Set rtitem = New NotesRichTextItem(mailDoc, "Body")
' get the document that's being forwarded and pop it into the mailing doc
Set lookupview = currdb.GetView("All By ID")
Set lookupdoc = lookupview.GetDocumentByKey(ForwardDoc)
If lookupdoc Is Nothing Then
agentlog.LogAction "could not find doc " & ForwardDoc
rtitem.AppendText "There was a problem mailing the requested document from QMR"
Else
' convert it to RT
lookupdoc.RenderToRTItem rtitem
End If ' end making sure we got the doc that's being forwarded
' finish up the email and send it
agentlog.LogAction "sending it"
mailDoc.SendTo = sendToString
Call mailDoc.Send(False)