Q

How do you use AppendDocLink when trying to send an email from VB/VBA?

How do you use AppendDocLink when trying to send an e-mail from VB/VBA?

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 If
it 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.

This was first published in February 2004

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

SearchWindowsServer

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

SearchDataCenter

SearchExchange

SearchContentManagement

Close