Create Doclink on Uidoc

I am trying to write a script to create a doclink to an external document who’s link (C:\temp\test.doc say) in pasted to the clipboard.

I have no trouble obtaining the link. I am however having trouble creating the doclink from thin the uidoc to which it is to be created on.

Has anyone been able to achieve this? Any ideas?

Subject: If the document is open in Edit mode…

…you could use NotesUIDocument.Paste() to insert the clipboard content at the current cursor position. Before that you might have to put the cursor on the RichText field, using methods NotesUIDocument.GotoField(), GotoTop() or GotoBottom(). You cannot, however, navigate programmatically to a specific insertion point within the RT field, as long as you are operating in the front-end.

A different approach would be to use back-end classes and operations. You could then control where exactly you want the link inserted into the RT field using the NotesRichtextNavigator class. On the other hand, that would mean you don’t have access to the clipboard. You’d have to create the .lnk file somehow and then attach that file using NotesRichtextItem.EmbedObject(). Note also that it is generally difficult to mix front-end and back-end operations on a document. That is, if you decide to take the back-end approach, it’s best to close the document, then manipulate the RT field in the back-end, then reopen the document if necessary.