Hallo zusammen,
habe nen Wiedervorlageagent gemacht ... Das gaze funktioniert wunderbar, solange ich es von Hand aufrufe. Jetzt habe ich den Agent mal als periodisch eingestellt, aber leider passiert nix! Hier der Code:
Sub Initialize
Dim session As New NotesSession
Dim current As NotesDatabase
Dim mailbox As New NotesDatabase("","")
Dim maildoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim sendto As String
Dim sendas As String
Dim i As Integer
Dim datetime As New NotesDateTime( "" )
'Zu Prüfende Schlüssel
Dim aview As notesview
Dim now_time As String
Dim db As NotesDatabase
Dim workspace As notesuiworkspace
Dim acol As NotesDocumentCollection
Dim doc As NotesDocument
Dim test As String
Dim akey As String
Set db = New notesDatabase ("OCS02/OCS GmbH","aktiv\fb013.nsf")
Set aview = db.getview ("vorlage")
dateTime.LSLocalTime = Now
Call dateTime.SetNow
now_Time = dateTime.LocalTime
now_time=Left(now_time,10)
Print now_time
akey = "FB013"
Set acol = aView.GetAllDocumentsbyKey( akey, True )
Print acol.count
For i = 1 To acol.count
Set adoc = aCol.GetFirstDocument
If adoc.docdatewiedervorlage(0) = now_time Then
Call mailbox.Open( "OCS02/OCS GmbH", "mail.box" )
sendto = adoc.DocSBWiedervorlage(0)
sendas = "SupportDB"
Set maildoc = mailbox.CreateDocument
maildoc.Form = "Memo"
maildoc.From = sendas
maildoc.SendFrom = sendas
maildoc.SendTo = sendto
maildoc.Recipients = sendto
maildoc.Subject = "Wiedervorlage Supportnr: " + adoc.DocLfdNr(0) + " Kunde: " + adoc.DocKunde(0)
Set rtitem = maildoc.CreateRichTextItem( "Body" )
Call rtitem.AppendDocLink(adoc, "Verknüpfung mit dem Dokument")
Call rtitem.AppendText( message )
maildoc.PostedDate = Now()
maildoc.ComposedDate = Now()
maildoc.DeliveredDate = Now()
maildoc.Principal = sendas
maildoc.EncryptOnSend = False
Call maildoc.Save( True, False )
End If
Next
End Sub
Würde mich freuen, wenn mir jemmand helfen kann!
Gruß Björn