|
|
|
|
|
|
|
|
|
|
|
|
|
|
Tools for working with Notes Doclinks (continued)
Lines 51 and 52 deal with reporting that one or more links pointed at external documents. And of course we must save the document in line 54, or we will lose the updated doclink comments.
Once this has been run, you will then see an enhanced comment in the Notes status line for every valid doclink. And for those that are broken, the status line comment will say that.
The Doclink Inserter This tool simplifies the whole process of inserting a doclink. I implemented it as a document action, only available when editing. It displays a view in the database via a Picklist asking for a selection. It then inserts a doclink to the selected document at the insertion point. Doing this is a little convoluted and a bit messy, but it does work and does seem reliable.
The problem is that a Doclink can only be created in text that's being edited by pasting it in with NotesUIDocument.Paste. And to paste a doclink, we have to have a doclink in the clipboard. The only way to get a doclink in the clipboard is to select and cut it using NotesUIDocument.Copy. So we have to have a NotesUIDocument from which to copy the doclink. Now let's look at the code.
01 Sub Click(Source As Button)
02 'Create and insert a doclink at the insertion point
03 Dim thisdoc As notesuidocument
04 Dim sess As New NotesSession
05 Dim wk As New notesuiworkspace
06
07 Set thisdoc = wk.CurrentDocument
08 Dim db As Notesdatabase
09 Dim picklist As NotesDocumentCollection
10 Dim doc As NotesDocument
11 Set DB = sess.currentdatabase
12
13 'first get the document to be linked to
14 Set picklist = wk.PickListcollection(PICKLIST_CUSTOM,False,db.server,db.filepath,"dTOC","Select a document","Select for Doclink")
15 If picklist.Count = 0 Then Exit Sub 'user cancelled the dialog
16
17 'get the pointed at document
18 Set doc = picklist.getfirstdocument
19 If doc Is Nothing Then Exit Sub 'shouldn't really happen
20
21 'now the awkward bit: the only way to insert a doclink into RT that you are editing is to paste it.
22 'the only way to get a pastable doclink into the clipboard is to copy one from an existing document
23 'so first we make a doclink in an RT field that links to the document
24 Dim tdoc As New NotesDocument(db)
25 tdoc.form = "doclink" 'a form that will only contain the field with the doclink and NOTHING else - not even a CR!
26 Dim trt As New NotesRichTextItem(tdoc,"body")
27 Call trt.appenddoclink(doc, "doclink")
28 'this doc must be saved otherwise the display doesn't work
29 Call tdoc.Save(True, False)
30 'now "display" the document so we can grab the doclink
31 Dim tuid As NotesUIDocument
32 Set tuid = wk.EditDocument(False, tdoc)
33 'select and copy the content
34 Call tuid.selectall
35 Call tuid.copy 'we should have the doclink inthe clipboard
36 Call tuid.Close 'close and throw away the temporary document
37 Call tdoc.Remove(True)
38 Call thisdoc.paste 'and paste the doclink
39 End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.
Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.
Learn how to easily clean up your address book. |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|