Hi… would appreciate some advice on why below is not working… its driving me nuts…!
The “Doc Link >>” text is displayed ok in the email memo field but AppendDocLink fails… no errors…
Strangely i cant seem to progrmatically get the cursor into the Body field either… tried GoToField, GotoBottom etc…
The Body field is richtext but encrypted… not sure if this causes an issue…?
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim mdb As New NotesDatabase( "", "" )
Dim libdoc As NotesDocument
Dim fbdoc As NotesDocument
Dim libuidoc As NotesUIDocument
Dim fbuidoc As NotesUIDocument
Dim rtitem As NotesRichtextItem
Set db = session.CurrentDatabase
Set libuidoc=workspace.CurrentDocument
Set libdoc=libuidoc.Document
Call mdb.OpenMail
Set fbuidoc = workspace.ComposeDocument( "", mdb.filename, "Memo" )
Set fbdoc = fbuidoc.Document
If Not libdoc Is Nothing Then
Set rtitem = New NotesRichTextItem( fbdoc, "Body" )
Call fbuidoc.FieldSetText("Body", "Doc link >> ")
Call rtitem.AppendDocLink( libdoc, "Library Link" )
Call fbuidoc.GoToField("Body")
End If
Call fbuidoc.Refresh
many thanks
-Alex
Subject: Can’t attach doclink
Call rtitem.AppendDocLink( libdoc, “Library Link” )I don’t see that you have a handle to libdoc
You can confirm this with code like this:
if (libdoc is Nothing) Then
msgbox(“nope… I don’t have a handle to libdoc”)
End If
This is a sample of how to get a handle to the backend doc
Set backendDoc = uidoc.Document
You have one line that looks like it should do it:
Set libdoc=libuidoc.Document
hmmm, have you saved the uidoc? You are aware that there is no backend doc until you’ve saved the uidoc, right?
-add this next line-
Call libuidoc.Save
Set libdoc=libuidoc.Document
-then confirm it
if Not (libdoc is Nothing) Then
msgbox(“YES!!! Notes Forum IS GREAT!!”)
End If

Subject: RE: Can’t attach doclink
Hi Stan… thanks for your reply…
I can confirm the uidoc was saved… even if i use the db or mdb handle for my doclink I have the same issue.
I think i have the handle check already…
f Not libdoc Is Nothing Then
Set rtitem = New NotesRichTextItem( fbdoc, “Body” )
Call fbuidoc.FieldSetText(“Body”, "Doc link >> ")
Call rtitem.AppendDocLink( libdoc, “Library Link” )
thanks again… any further thoughts greatly appreciated.
-Alex
Subject: RE: Can’t attach doclink
You are editing the UI field widget and the back-end field at the same time. When it comes to rich text fields, think of the UI editor as a word processing or text editing application, and the back-end rich text item as the file it creates. What you are doing here is essentially the same as opening a DOC file in Word from the server and editing it while somebody else is programmatically changing the file on the server. When you save your DOC, your changes overwrite the version the other fellow modified on the server.
Instead of comosing the document, Create it. That’s a back-end method. Set the fields you want to set programmatically in the back-end document – and that includes using NotesRichTextItem.AppendText() instead of FieldSetText(). If you have a good reason to bring the document into the user interface (for additional editing, say), then do it by setting the uidoc to workspace.EditDocument(true, fbdoc).
Subject: RE: Can’t attach doclink
Thanks Stan… i think i’m just using the back-end classes now… and if i use doc.send it does work…woohoo.!
however cant get the doclink or text to display in the user interface…which i really need or will have to resort to a dialog to capture/append the user’s message… any idea’s?
Function Send_Feedback
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim mdb As New NotesDatabase( "", "" )
Dim libdoc As NotesDocument
Dim fbdoc As NotesDocument
Dim pdoc As NotesDocument
Dim libuidoc As NotesUIDocument
Dim fbuidoc As NotesUIDocument
Dim rtitem As NotesRichTextItem
Set db = session.CurrentDatabase
Set libuidoc=workspace.CurrentDocument
Set libdoc=libuidoc.Document
Call mdb.OpenMail
Set fbdoc = mdb.CreateDocument
Set pdoc = db.GetProfileDocument("Library_Profile")
fbdoc.EnterSendTo = pdoc.Library_Profile_Administrator(0)
fbdoc.Subject = pdoc.Library_Profile_Name(0) + " Feedback"
If Not libdoc Is Nothing Then
Set rtitem = New NotesRichTextItem( fbdoc, "Body" )
If Not rtitem Is Nothing Then
Call rtitem.AppendText( "Document Link >> ")
Call rtitem.AppendDocLink( libdoc, "Do Link" )
Msgbox "done"
End If
End If
Call workspace.EditDocument( True, fbdoc )
End Function
thanks again.