Lotus Domino script snippet finding readers fields in Notes documents
This piece of LotusScript checks each document in the Notes database to see if the document has readers fields stored in it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
Option Public Option Declare Sub Initialize 'If all Readers fields are blank, anyone can read the document. 'If there are multiple Readers fields and some are blank, the non-blank fields limit access. Dim sn As New NotesSession Dim db As NotesDatabase Dim dbCur As NotesDatabase Dim doccol As NotesDocumentCollection Dim doc As NotesDocument Dim lngCnt As Integer On Error 4060 GoTo NoDbAccess 'lsERR_NOTES_DBNOACCESS On Error GoTo ErrorHandler Set dbCur = sn.Currentdatabase Set db = sn.GetDatabase("Server/Name", "filepath\filename.nsf") 'Results in error 4060 if No Access --> db Is Nothing If Not db Is Nothing Then If db.IsOpen Then Set doccol = db.Alldocuments If doccol.Count > 0 Then Set doc = doccol.GetFirstDocument While Not doc Is Nothing ForAll itm In doc.Items If itm.Isreaders Then If itm.Text <> "" Then 'Reader field found Print "reader field found" GoTo NextDoc End If End If End ForAll NextDoc: Set doc = doccol.GetNextDocument(doc) Wend End If Else Print "DB DOES NOT EXIST" End If Else Print "NO ACCESS" End If Exit Sub NoDbAccess: 'Error 4060 Print "no access to database " & db.Filepath & " - resuming next database..." Resume Next Exit Sub ErrorHandler: Print "Error..." Exit Sub End Sub |