Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %REM
- Agent Run
- Created Nov 27, 2018 by Admin/Universe
- Description: Comments for Agent
- %END REM
- Option Public
- Option Declare
- Const ServerName = "Domino/Universe"
- Const NabFileName = "names.nsf"
- Const UserLicName = "userlicenses.nsf"
- Sub Initialize
- Dim ses As New NotesSession
- Dim db As NotesDatabase
- Dim NABDb As NotesDatabase
- Dim LicDb As NotesDatabase
- Set NABDb = New NotesDatabase(ServerName,NABFileName)
- If Nabdb Is Nothing Then
- MsgBox "Could not open your NAB database " + NABFilename + " at server " + ServerName
- GoTo selesai
- End If
- Set LicDb = New NotesDatabase(ServerName,UserLicName)
- If LicDb Is Nothing Then
- MsgBox "Could not open your License database " + UserLicName + " at server " + ServerName
- GoTo selesai
- End If
- Dim NABView As NotesView
- Set NABView = NABdb.Getview("($VIMPeople)")
- Dim NABPeopleDoc As NotesDocument
- Set NABPeopleDoc = NABView.Getfirstdocument()
- Dim LicDoc As NotesDocument
- Dim strMissingPerson As String
- Dim strPerson as string
- Dim NNPerson As NotesName
- While Not NABPeopleDoc Is Nothing
- 'Print NABPeopleDoc.FullName(0)
- strPerson = NABPeopleDoc.FullName(0)
- Set NNPerson = New NotesName(strPerson)
- Set LicDoc = getDocumentByKey(NNPerson.canonical,"($LicUsers)",LicDb)
- If LicDoc Is Nothing Then
- strMissingPerson = strMissingPerson + NNPerson.abbreviated + "; "
- End If
- Set NABPeopleDoc = NABView.Getnextdocument(NABPeopleDoc)
- Wend
- msgbox "Missing Person are " + strMissingPerson
- selesai:
- Exit sub
- End Sub
- Sub Terminate
- End Sub
- Function getDocumentByKey(strKey As String,strView As String, lookupdb As NotesDatabase) As NotesDocument
- Set getDocumentByKey = Nothing
- Dim act As String
- Dim errstr As String
- On Error GoTo errhandler
- Dim viewLookup As NotesView
- Dim viewLookupName As String
- viewLookupName = strView
- Set viewLookup = lookupdb.Getview(viewLookupName)
- If viewLookup Is Nothing Then
- MsgBox "view " + strView + " not found!"
- GoTo keluar
- End If
- Dim lookupDoc As NotesDocument
- Set lookupDoc = viewLookup.Getdocumentbykey(strKey,True)
- If lookupDoc Is Nothing Then
- 'is okay!
- GoTo keluar
- End If
- Set getDocumentByKey = lookupdoc
- keluar:
- Exit Function
- errhandler:
- errstr = "function getDocumentByKey error found ...." & Str(Err) & ": " & Error$ + " at line " + CStr(Erl)
- Print errstr$
- Resume Next
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement