Manage Learn to apply best practices and optimize your operations.

Notesunreadmarks Class

Represents a collection of unread documents from a database, selected according
to a username.







Access & New

The NotesUnreadMarks represents a subset of all the documents in a database.
The documents in the subset are determined by which documents are unread by the
user at the time a new instance is created.

Creates a NotesUnreadMarks object that represents the unread documents for a
specific user in a specific replica of a database database located at the
server and file name you specify.


Dim variableName As New NotesUnreadMarks( notesDatabase, username$ )
Set notesunreadmarks = New NotesUnreadMarks( notesDatabase, username$ )

If the user name is hierarchical, the username parameter must be passed in the
canonical format. eg. CN=First Name/OU=Office/O=Company/C=Country


Dim sess As New NotesSession
Dim db As NotesDatabase
Dim urm As NotesUnReadMarks
Dim doc As NotesDocument
Dim msgbody As String

Set db = sess.CurrentDatabase
Set urm = New NotesUnreadMarks(db,sess.UserName)
Set doc = urm.GetFirstDocument

msgbody = "Server: " + urm.Server + Chr(13)
msgbody = Msgbody + "Filepath: " + urm.FilePath + Chr(13)
msgbody = Msgbody + "Username: " + urm.Username + Chr(13) + Chr(13)
msgbody = Msgbody + "Here are the unread marks from first to last." +
Chr(13) + Chr(13)

While Not doc Is Nothing
msgbody = msgbody + doc.Subject(0) + Chr(13)
Set doc = urm.GetNextDocument(doc)

Messagebox msgbody,0,"Unread Documents"
'Paste into the Declarations section of your Script.

' NotesUnreadMarks class (R1.0)
' Written by: Daniel Alvers (
' PricewaterhouseCoopers (Aust)
' February, 7 2000
' This code is provided as is and no warranty, express or implied, exists as to
its fitness for use for any purpose.
' You are free to use and distributed the code as long as credit is retained
and this header is not removed

Declare Function W32_SECKFMGetUserName Lib "nnotes.dll" Alias
"SECKFMGetUserName" ( Byval UserName As String) As Integer
Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" ( Byval
dbName As String, hDb As Long) As Integer
Declare Function W32_IDScan Lib "nnotes.dll" Alias "IDScan" ( Byval
hUnreadTable As Integer, Byval First As Integer, NoteID As Long) As Integer
Declare Function W32_NSFDbGetUnreadNoteTable Lib "nnotes.dll" Alias
"NSFDbGetUnreadNoteTable" (Byval hDb As Long, Byval UserName As String, Byval
NameLength As Integer, Byval Create As Integer, hUnreadTable As Integer) As
Declare Function W32_NSFDbUpdateUnread Lib "nnotes.dll" Alias
"NSFDbUpdateUnread" ( Byval hDb As Long, Byval hTable As Integer) As Integer
Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" ( Byval hDb
As Long) As Integer
Declare Function W32_IDDestroyTable Lib "nnotes.dll" Alias "IDDestroyTable" (
Byval hTable As Integer) As Integer
Declare Function W32_IDInsert Lib "nnotes.dll" Alias "IDInsert" ( Byval hTable
As Integer, Byval NoteID As Long, retInserted As Integer) As Integer
Declare Function W32_IDDelete Lib "nnotes.dll" Alias "IDDelete" ( Byval hTable
As Integer, Byval NoteID As Long, retDeleted As Integer) As Integer
Declare Function W32_IDIsPresent Lib "nnotes.dll" Alias "IDIsPresent" (Byval
hTable As Integer, Byval NoteID As Long) As Integer
Declare Function W32_IDTableCopy Lib "nnotes.dll" Alias "IDTableCopy" ( Byval
hOriginalTable As Integer, hNewCopy As Integer) As Integer
Declare Function W32_NSFDbSetUnreadNoteTable Lib "nnotes.dll" Alias
"NSFDbSetUnreadNoteTable" ( Byval hDb As Long, Byval UserName As String, Byval
NameLength As Integer, Byval Flush As Integer, Byval hOriginalTable As Integer,
Byval hUnreadTable As Integer) As Integer

Type NoteIndex
PrevNoteID As Long
NoteID As Long
NextNoteID As Long
End Type

Class NotesUnReadMarks

Private DocList List As NoteIndex
Private DocArray() As String
Private NoteID As Long
Private hUnreadTable As Integer
Private hOriginalTable As Integer
Private rc As Integer
Private hDb As Long
Private dbNotesDatabase As NotesDatabase
Private sPrvServer As String
Private sPrvFilePath As String
Private sPrvDatabase As String
Private sPrvUsername As String
Private lPrvFirstNoteID As Long
Private lPrvLastNoteID As Long

Sub Delete
Call W32_IDDestroyTable(hUnreadTable)
Call W32_NSFDbClose(hDb)
End Sub

Sub New (inpNotesDatabase As NotesDatabase, inpUserName As String)

Dim lCurrentNoteID As Long
Dim iPrvScanFlag As Integer

Set Me.dbNotesDatabase = New
Me.sPrvServer = inpNotesDatabase.Server
Me.sPrvFilePath = inpNotesDatabase.FilePath
Me.sPrvUserName = inpUserName

If Me.dbNotesDatabase Is Nothing Then
Error 14005, "NotesUnreadMarks: Invalid database object."
End If

If Me.sPrvServer = "" Then
sPrvDatabase = Me.sPrvFilePath
sPrvDatabase = Me.sPrvServer + "!!" + Me.sPrvFilePath
End If

'Open the target database
Me.rc = W32_NSFDbOpen(sPrvDatabase, Me.hDb)
If Me.rc <> 0 Then
Error 14001, "NotesUnreadMarks: Unable to open database."
End If

This was last published in November 2000

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...