我是lotusscripting的初學程序員,並且自己創建了一些基本代碼。最近我製作了一個預定的代理程序,將文檔複製到視圖中並將其移動到另一個數據庫(檔案庫)。但是還有一個需要完成的改進,那就是使存檔數據庫的位置變爲動態。你可以在我的代碼中看到,服務器/路徑&文件名是硬編碼:Lotus Domino(Lotusscript):動態查找文檔 - 查看
%REM
Agent Archive Kiosk Walk-In Test
Created Dec 11, 2015 by Daryl
Description: Comments for Agent
%END REM
Option Public
Option Declare
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dbArchive As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim tmpDoc As NotesDocument
Dim docArchive As NotesDocument
Dim archiveDate As NotesDateTime
Dim createDate As NotesDateTime
Dim count As Integer
Dim serverName As String
Dim archiveName As String
Set db = s.Currentdatabase
Set archiveDate = New NotesDateTime("Today")
Call archiveDate.Adjustday(-30)
Set view = db.Getview("KWICompletedView")
view.Autoupdate = False
'Static declaration of database for archive
serverName = "SBYGAD61/SBYISDEV"
archiveName = "reso\var\test\resovara.nsf"
Set dbArchive = New NotesDatabase(serverName, archiveName)
If dbArchive Is Nothing Then
Print "Warning: unable to access archive database."
Else
count = 0
Set doc = view.Getfirstdocument
While Not(doc Is nothing)
Set tmpDoc = view.Getnextdocument(doc)
Set createDate = New NotesDateTime("")
createDate.Localtime = doc.Created
If archiveDate.Timedifference(createDate) > 0 Then
Set docArchive = New NotesDocument(dbArchive)
Call doc.Copyallitems(docArchive, True)
Call docArchive.Save(True, True)
'Call doc.Remove(True)
count = count + 1
End If
Set doc = tmpDoc
Wend
Print "Complete: "+Cstr(count)+" document(s) archived."
End If
End Sub
有一個在我當前的數據庫視圖包含歸檔DBS的位置,是的,有3個存檔DBS所以我就真的失去了,我很抱歉。我需要幫助,我將如何將這些文檔實際獲取/設置爲我的歸檔位置。謝謝!
只是一個建議:閱讀標準的Notes存檔功能。 –