高分求解LS搜索问题,我想搜索符合条件的文档并把它放到第一次使用后私有的文件夹中!源代码贴出来了!
执行到Call dc.PutAllInFolder("QueryResults")总是报错:
Notes error:正在把所有有关的文档及其父文档一起加入到此文件夹中
(queryresults).
难道答复文档不能一起放入文件夹中?????
Sub Click(Source As Button)
Dim ws As NotesUIWorkspace
Dim s As NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim dc As NotesDocumentCollection
Dim vw As NotesView
Dim vwe As NotesViewEntryCollection
Dim thetime As NotesDateTime
Dim srchstring As String
Dim thetitle As String
Dim theauthor As String
Dim thedept As String
Dim thedate As String
Dim datedir As String
Dim themax As String
Dim maxdocs As Integer
Dim titlecondition As String
Dim authorcondition As String
Dim departmentcondition As String
Dim datecondition As String
Set ws = New NotesUIWorkspace
Set uidoc = ws.CurrentDocument
Set s = New NotesSession
Set db = s.CurrentDatabase
Set vw = db.GetView("QueryResults")
Set doc = vw.GetFirstDocument
While Not(doc Is Nothing)
Call doc.RemoveFromFolder("QueryResults")
Set doc = vw.GetNextDocument(doc)
Wend
' Set vwe = vw.AllEntries
' Call vwe.RemoveAllFromFolder("QueryResults")
thetitle = uidoc.FieldGetText("FldTitle")
theauthor = uidoc.FieldGetText("FldAuthor")
thedept = uidoc.FieldGetText("FldDepartment")
thedate = uidoc.FieldGetText("FldCreated")
datedir = uidoc.FieldGetText("FldDateDirection")
If thetitle <> "" Then
titlecondition = "@Contains(FldTitle;""" + thetitle + """)"
End If
If theauthor <> "" Then
authorcondition = "FldAuthor = """ + theauthor + """"
End If
If thedate <> "" Then
datecondition = "@Created " + datedir + "[" + thedate + "]"
End If
srchstring = titlecondition
If srchstring <> "" And authorcondition <> "" Then
srchstring = srchstring + " & " + authorcondition
Else
srchstring = srchstring + authorcondition
End If
Set thetime = New NotesDateTime("1/1/1990")
Set dc = db.Search(srchstring, thetime, 0)
Call dc.PutAllInFolder("QueryResults")
End Sub