Domino Code Fragment

Code Name*
How do you operate on the currently selected documents in LotusScript?
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.52.14.22.250
Description*
The ... part in the code below marks where you can put code to access the active document.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
To determine the currently selected document in a view you have to traverse it with the
NotesDatabase property:UnprocessedDocuments which returns a document collection that you
can examine. The ... part in the code below marks where you can put code to access the
active document. This may look strange, but it actually only returns the document that you
currently stand on (unless you have marked a set of documents).

  Dim workspace As New notesuiworkspace
 Dim uidoc As notesuidocument
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim collection As NotesDocumentCollection
 Dim doc As NotesDocument
 Set db = session.CurrentDatabase
 Set collection = db.UnprocessedDocuments
 For i = 1 To collection.Count
   Set doc = collection.GetNthDocument(i)
   ...
 Next