I have an agent that detaches email attachments to a shared drive that works from a button perfectly. I need it to work as a scheduled agent that runs once a day. I’ve modified the agent Trigger and Target and can’t get it to work. I am not very good with Lotus Script and have limited experience with LS agents.
The code is below. Thanks
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim rtitem As Variant
Set db = session.CurrentDatabase
Set collection = db.unprocessedDocument
set doc = collection.GetFirstDocument()
While Not(doc is Nothing)
set rtitem = doc.GetFirstItem("Body")
If (rtitem.Type = RICHTEXT) Then
Forall o In rtitem.EmbeddedObjects
If (o.Type = EMBED_ATTACHMENT) Then
Call o.ExtractFile("c:\TEMP\" & o.Source)
End If
End Forall
End If
Set doc = collection.GetNextDocument(doc)
Wend
End Sub