to a username.
Contains:
NotesDocument
Properties:
Server
Filepath
Username
Methods:
GetFirstDocument
GetLastDocument
GetNextDocument
GetPrevDocument
IsRead
MarkDocumentRead
MarkDocumentUnread
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.
Syntax
Dim variableName As New NotesUnreadMarks( notesDatabase, username$ )
or
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
Example
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)
Wend
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
Integer
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
NotesDatabase(inpNotesDatabase.Server,inpNotesDatabase.FilePath)
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
Else
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
End If
This was first published in November 2000