Tip

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

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.