Sub Initialize
'** This is an example of using the UnreadDocList class
'** PLEASE REMOVE THIS SUB IF YOU COPY THE CLASS
'** TO AN AGENT OR SCRIPT LIBRARY
Dim session As New NotesSession
Dim db As NotesDatabase
Dim inbox As NotesView
Dim mailDb As Variant
Dim udc As New UnreadDocList
Dim unreadArray As Variant
mailDb = Evaluate("@MailDbName")
'Set db = session.CurrentDatabase
Set db = session.GetDatabase(mailDb(0), mailDb(1))
Set inbox = db.GetView("($Inbox)")
unreadArray = udc.getUnreadInView(inbox, session.EffectiveUserName)
If (Len(udc.getLastError()) > 0) Then
Print "There was an error: " & udc.getLastError()
End If
If (unreadArray(0) = "") Then
Print "There are 0 unread docs in your inbox"
Else
Print "There are " & (Ubound(unreadArray) + 1) & " unread docs in your inbox"
End If