次のエージェントは、lsERR_NOTES_BAD_UNID の処理を示します。エラーを発生させるため、UNID は故意に変えてあります。%INCLUDE "lsxbeerr.lss"
Sub Initialize
On Error lsERR_NOTES_BAD_UNID Goto processError
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument, pdoc As NotesDocument
Dim docSubj As String, pdocSubj As String
Dim badID As String
Set db = s.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
While Not(doc Is Nothing)
If doc.IsResponse Then
docSubj = doc.Subject(0)
' Deliberately munge UNID
badID = "Z" & Right(doc.ParentDocumentUNID, 31)
Set pdoc = db.GetDocumentByUNID(badID)
pdocSubj = pdoc.Subject(0)
Messagebox "Parent: " + pdocSubj,, docSubj
End If
getNextDocument:
Set doc = dc.GetNextDocument(doc)
Wend
Exit Sub
processError:
Messagebox docSubj,, "Bad UNID for ..."
Resume getNextDocument
End Sub