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 last published in November 2000

Dig Deeper on Domino Resources

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.

-ADS BY GOOGLE

SearchWindowsServer

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

SearchDataCenter

SearchExchange

SearchContentManagement

Close