Today I had an interesting issue I definitely need to put out here to be able to rememberÂ it in the future.
I used a piece of code (see below) toÂ append aÂ link to a document, sent out via an email message to another user. When the recipient opened that message and clicked the doclink a dialogue box came up “The Doclink database cannot be located.” asking the user to select the server where the linked database is located. This issue however did only happen in some circumstances.
' create notification document
Â Set docMemo = New NotesDocument (db)
Â With docMemo
Â .CopyTo = vCopyTo
Â .Subject = sSubject
Â End With
Â Set rtitem = New NotesRichTextItem (docMemo,"Body")
Â Call rtitem.AppendText (sMessage)
Â Call rtitem.AddNewline (2)
Â Call rtitem.AppendDocLink (vDocLink,"")
Â Call rtitem.AppendText (" <- link to document")
Â Call docMemo.Send(False)
Researching thatÂ error messageÂ at the IBM knowledge base I found a document describing exactly the sameÂ issue.
TheÂ problem only arises in various circumstances where the linked document is found on a differentÂ server then the user’s mail file andÂ the comment$ parameter of the AppendDocLink method is an empty string.Â The problem is described different for version 4 and 5 of Lotus Notes. However, I discovered itÂ happeningÂ in Lotus Notes 6.5 too.
As a workaround it is suggested to not submit an empty string asÂ comment$, this however is only working as long as the user ‘lives’ in the same hierarchy as the id (user) creating the document link.
Lessons learned: I guess that’s another point on the Best Practices list for future development – “Never leave the comment$ parameter empty”