Unread Marks possible to programming

tord_f used Ask the Experts™

I have a database with unread marks. I works that it used to but I wan't to do ´this:

When a user opens a document the document is markes read.

Once a week an Agent is run that alter one Authors-field to make it impossible for a user to change documents.

My problem is that when the Agent is run the document is marked unread again, but the users have read them.

Is is possible to solve that, in version 5 (.11) or can I solve it with version 6.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Systems architect
Top Expert 2006
The functions to enumerate unread docs for a user and switch the unread marks are available only in API.

It is difficult to determine the correct parameters for particular users and it it is not worth the effort.
It is only interesting for playing around with it.

Here the first part of it to fetch all documents unread by actaul user:

Option Public
Option Declare
Declare Function IDEntries Lib "nnotes.dll" (Byval hTable&)As Integer
Declare Sub NSFDbClose Lib "nnotes.dll" (Byval DBHANDLE&)
Declare Sub OSMemFree Lib "nlib.dll" (Byval Handle As Long)
Declare Function OSPathNetConstruct Lib "nlib.dll" ( Byval PortName$, Byval ServerName$, Byval FileName$, Byval retPathName$)As Integer
Declare Function NSFDbOpen Lib "nnotes.dll" ( Byval PathName$, rethDB&)As Integer
Declare Function IDScan Lib "nnotes.dll" (Byval hTable&, Byval fFirst%, DWORD&)As Integer
Declare Function NSFDbGetUnreadNoteTable Lib "nnotes.dll" (Byval DBHANDLE&, Byval UserName$, Byval UserNameLength%, Byval                     fCreateIfNotAvailable%, rethUnreadList&)As Integer
Declare Function NSFDbUpdateUnread Lib "nnotes.dll" (Byval DBHANDLE&,Byval UnreadList&) As Integer

Sub Initialize
   Dim s As New notessession
   Dim Ret#
   Dim UName$
   Msgbox "In the LOG.NSF file " & UName$ & " has " & Ret# & " Unread Docs " 
End Sub

Function GetUnreadDocs(Server$,Database$,UserName$)As Long
   Dim DBHND&, id&,ct&
   Dim fFirst%
   Dim retPathName$
   Dim Status%
   Dim Entries&
   Dim hTable&
   Status%=NSFDbGetUnreadNoteTable(DBHND&,UserName$,Len(UserName$), True, hTable&)
   Do While IDScan(hTable&,fFirst%,id&)
      Print "DOC ID " & Hex$(id&) , Cstr(id&)
      'This is where you should be able to use to set a notes document.
      'Set doc = db.GetDocumentByID(Hex$(id&))
   Call OSMemFree(hTable&)
   Call NSFDbClose(DBHND&)
End Function



Thanks for the code.

I vill try and experiment and maybe I have a solution in the future.
Zvonko זְאֵבSystems architect
Top Expert 2006

Oh, thanks for the points :-)

The upper code is only to read Unread Marks.
The code you asked for I have in my office tips collection.
I am first on Tuesday in office and will look for your code.

So long,


The code function perfekt and read the unread marks. The only thing that is missing is code that marks documents.

I have scan Notes net but I don't find much about APIs. Is APIs for Notes published at the webb?


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial