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 (daniel.alvers@au.pwcglobal.com)
' 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 first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.