If I try it as
Set objLink_DB = ObjNotes.GetDatabase(Server, NotesDb) Set objLink_View = objLink_DB.getview(NotesView) Set objLink_Doc = objLink_View.getdocumentbykey(NotesKey, True) If Not (objLink_Doc Is Nothing) Then Call rtItem. AppendDocLink(objLink_Doc, "Test") End Ifit generates the message:
Automation Error: The server threw an error
Probably the error is that the RTitem doesn't exist. Before you append a document link, you need to create the Rich Text item. I don't know if you have created your newDoc to send the e-mail, but you'll need to include code like the following to create the Rich Text field body in your e-mail message.
' create outgoing mail message document Set objLink_newDoc = New NotesDocument( objLink_DB ) 'create the body field in the new message document Set rtitem = New NotesRichTextItem (objLink_newDoc, "Body" ) 'then append the doc link (your code) If Not (objLink_Doc Is Nothing) Then Call rtItem. AppendDocLink(objLink_Doc, "Test") 'you could also use the documents subject field as in 'Call rtItem.AppendDocLink (objLink_Doc, objLink_Doc.Subject( 0 ) ) End If 'just in case you need samples of the other mail fields objLink_newDoc.Subject = "Here is a link to the database" objLink_newDoc.SendTo = "Lauri Nodwell" objLink_newDoc.Send( False )
Do you have comments on this Ask the Expert Q&A? Let us know.
Dig Deeper on Lotus Notes Domino Application Development
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