I have written an agent to move all documents it encounters in a folder entitled ‘Index’ to a folder specified in a field on the document itself.
The agent seems to run, but the documents are not moved.
Here’s the code;
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim strDestBinder As String
dim strSubject as string
Dim agentLog as NotesLog
'get a handle on the h_Index view, which contains all documents
Set db = session.CurrentDatabase
Set view = db.GetView("h_Index")
'set up agent log
Set agentLog = New NotesLog("Agent Log")
Call agentLog.OpenAgentLog
'get first document in view
Set doc = view.GetFirstDocument
While Not(doc Is Nothing)
strSubject = doc.Subject
Call agentLog.LogAction("Starting move - " & strSubject)
'get destination binder from field on document
strDestBinder = doc.DestBinder
Call agentLog.LogAction("Destination Binder is - " & strBinder)
'put doc into folder
Call doc.PutInFolder(strDestBinder,True)
Call agentLog.LogAction("Document move completed")
Set doc = view.GetNextDocument(doc)
Wend
End Sub
Any help appreciated
V