Search code examples
lotus-noteslotusscript

No "Script Area" in Lotus Notes Agent editor


I need the functionality described here: Determining which folder contains a document in Lotus Notes without using the LotusScript FolderReferences property

It says: "And the following code in the Script Area". But there's no script area. There's a tree containing "Document Selection", "(Options)", "Declarations", "Initialize", and , "Terminate".


Solution

  • You can enter that code into the body of the Initialize method. Make sure to keep the code that automatically appears when you select Initialize and just enter the code in the middle

    Sub Initialize
    
        Dim session As New notessession
        Dim db As notesdatabase
        Dim doc As notesdocument
        Dim doc2 As notesdocument
        Dim view As notesview
        Dim noteid1 As String
        Dim noteid2 As String
        Dim item As notesitem
        Dim collection As notesdocumentcollection
        Set db=session.CurrentDatabase
        Set collection=db.UnprocessedDocuments
        Set doc=collection.getfirstdocument
        noteid1=doc.NoteID
        Forall v In db.Views
    
            If v.isfolder Then
              Set doc2=v.GetFirstDocument
              While Not doc2 Is Nothing
                noteid2=doc2.NoteID
                If noteid1=noteid2 Then
                    Messagebox v.name
                End If
                Set doc2=v.getnextdocument(doc2)
              Wend
            End If
    
        End Forall
    
    End Sub