LOTUSSCRIPT/COM/OLE CLASSES
Examples: GetParentDocument method
1. This script finds the parent of the last document in the By Category view of a discussion database and displays its universal ID.
Sub Click(Source As Button)
Dim db As New NotesDatabase( "Byzantium", "discuss.nsf" )
Dim view As NotesView
Dim doc As NotesDocument
Dim parentDoc As NotesDocument
Set view = db.GetView( "By Category" )
If view Is Nothing Then
Messagebox "View not found"
Exit Sub
End If
Set doc = view.GetLastDocument
If doc Is Nothing Then
Messagebox "Last document not found"
Exit Sub
End If
If doc.IsResponse Then
Set parentDoc = view.GetParentDocument( doc )
If parentDoc Is Nothing Then
Messagebox "Error reading parent document"
Exit Sub
End If
Messagebox parentDoc.UniversalID, , _
"UNID of parent of last document"
Else
Messagebox doc.UniversalID, ,"UNID of last document"
End If
End Sub
2. This function takes a document and returns its ancestor -- that is, the original main document that began a response hierarchy. This is useful for discussion databases in which response-to-response documents often nest many levels deep.
Function getAncestor ( doc As NotesDocument ) _
As NotesDocument
Dim view As NotesView
Set view = doc.ParentView
If Not(Doc Is Nothing) Then
While doc.IsResponse
Set doc = view.GetParentDocument( doc )
Wend
End If
Set getAncestor = doc
End Function
See Also
GetParentDocument method
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary