Get Unread Docs

Here is how you can get unread docs in a database using th API.
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 IDEntries Lib "nnotes.dll" (Byval hTable&)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
Declare Sub NSFDbClose Lib "nnotes.dll" (Byval DBHANDLE&)
Declare Sub OSMemFree Lib "nlib.dll" (Byval Handle As Long)

Sub Initialize
Dim s As New notessession
Dim Ret#
Dim UName$

UName$=s.commonusername
Ret#=GetUnreadDocs("","log.nsf",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&

retPathName$=Space$(256)
Status%=OSPathNetConstruct("",Server$,Database$,retPathName$)
Status%=NSFDbOpen(retPathName$,DBHND&)
Status%=NSFDbGetUnreadNoteTable(DBHND&,UserName$,Len(UserName$), True,
hTable&)
Status%=NSFDbUpdateUnread(DBHND&,hTable&)
Entries&=IDEntries(hTable&)
ct&=0
ID&=0
fFirst%=True
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&))
fFirst=False
ct&=ct&+1
Loop
Call OSMemFree(hTable&)
Call NSFDbClose(DBHND&)
GetUnreadDocs=ct&

End Function
This was first published in November 2000

Dig deeper on Domino Resources

0 comments

Oldest 

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:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close