R7WEBSERVICES例子 土豆爷爷丢砖头
'GetSubject:
Option Public
Use "CB_opendbf"
%INCLUDE "lsxsd.lss"
Dim s As NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim msg As String
Class GetSubject
Sub NEW
Set s = New NotesSession
End Sub
Function getFirstSubject(dbname As String, viewname As String) As String
If openDatabase(dbname) Then
If openView(viewname) Then
Set doc = view.GetFirstDocument
If doc Is Nothing Then
msg = "Cannot get first document "
Else
Call getSubject
End If
End If
End If
getFirstSubject = msg
End Function
Function getLastSubject(dbname As String, viewname As String) As String
If openDatabase(dbname) Then
If openView(viewname) Then
Set doc = view.GetLastDocument
If doc Is Nothing Then
msg = "Cannot get last document "
Else
Call getSubject
End If
End If
End If
getLastSubject = msg
End Function
Function getNthSubject(dbname As String, viewname As String, n As Integer) As String
If openDatabase(dbname) Then
If openView(viewname) Then
Set doc = view.GetNthDocument(n)
If doc Is Nothing Then
msg = "Cannot get document " & n
Else
Call getSubject
End If
End If
End If
getNthSubject = msg
End Function
Private Function openDatabase(dbname As String) As Boolean
'Set db = s.GetDatabase("", dbname)
Set db = opendb(dbname) '
If db.IsOpen Then
openDatabase = True
Else
openDatabase = False
msg = "Cannot open database " & dbname
End If
End Function
Private Function openView(viewname As String) As Boolean
Set view = db.GetView(viewname)
If view Is Nothing Then
openView = False
msg = "Cannot open view " & viewname
Else
openView = True
End If
End Function
Private Sub getSubject
If doc.HasItem("Subject") Then
msg = doc.GetItemValue("Subject")(0)
Else
msg = "Document does not have Subject"
End If
End Sub
End Class
补充:企业软件 , Lotus