|
rtNoteLink
add (rtContainer)
addNewLine (rtContainer)
addNewLine (rTextParagraph)
appendText (rtContainer)
appendText (rTextParagraph)
Add (rtCollection)
Add (rTextParagraph)
Collection (rtContainer)
Collection (rtEnumeration)
getDatabase
getDoc
getRichTextItem
getView
hasMoreElements
NDL
NextElement
|
Code fragment from sample "Retrieve info from doclinks"; see full running samples in downloadable help.
|
Set ctx =New rtContainer ' retrieve the code in one container
Call ctx.getRichTextItem(doc,"Body")
Set hotcoll = ctx.Collection(PARSE_GROUP_LINKS) ' there are also other ways to get the links
Set enum = New rtEnumeration(hotcoll)

Dim o As rtNoteLink  ' current element of returned collection
Dim docTarget As NotesDocument ' docLink NotesDocuments - if target server is unavailable may not be retrieved
Dim ndbTarget As NotesDatabase ' doclink Database
Dim docView as NotesDocument
Dim vwTarget As NotesView ' doclink view - does not apply for Database links
Dim viewTitle as String, Titles as Variant
Dim rtp as rTextParagraph
Set rtp = ctxDump.appendText ("Documents in RT item")
ctxDump.addNewLine 1
' use rtEnumeration to loop through the returned collection
Do While enum.hasMoreElements
 Set o = enum.nextElement ' in general collection may contain different objects,
     ' so we would need to check what has been returned befor assigning it to rtNoteLink
 Set rtp=New rTextParagraph ( "############################")
' some uncanny layout; see better at text, table and section formatting samples
 ctxDump.add rtp
 ctxDump.addNewline 1
 ' the code below will search link target on current server
 ' if databases are on other servers than current one use DBReplicaID and docUNID properties to get the IDs
 ' then use NotesDatabase.OpenReplicaByID and getDocumentByUNID methods
 Set ndbTarget = o.getDatabase
 Set vwTarget = o.getView
 Set docTarget = o.getDoc
 If ndbTarget Is Nothing Then
  ctxDump.appendText "Could not open database"
  ctxDump.addNewLine 1
 Else
  ctxDump.appendText "Database: " &ndbTarget.Title
  ctxDump.addNewLine 1
 End If
 If vwTarget Is Nothing Then
  ctxDump.appendText "Could not open view"
  ctxDump.addNewLine 1
 Else
  ctxDump.appendText "View: " &vwTarget.Name
  ctxDump.addNewLine 1
 End If
 If Not docTarget Is Nothing Then
  ' get one possible title field
  Titles = Evaluate ({@trim(Subject:tTitle:Title)}, docTarget)
  ctxDump.appendText "Doc Title: " &Titles(0)
  ctxDump.addNewLine 1
  ctxDump.appendText "Server: " &docTarget.parentDatabase.server
  ctxDump.addNewLine 1
  ctxDump.appendText "Filepath: " &docTarget.parentDatabase.filepath
  ctxDump.addNewLine 1
 Else 
  ctxDump.appendText "Could not open document"
  ctxDump.addNewLine 1
  ctxDump.appendText o.NDL
' NDL - tagged structure used as Notes shortcuts in file system;
' the value of NDL saved to file with extension "ndl" will act as a shortcut to document; ' this file may be attached back to NotesDocument making it "non-Notes" enabled link
  ctxDump.addNewLine 1
 End If
 ctxDump.add o ' add the link just examined
 ctxDump.addNewLine 1
Loop
|
|