Das Notes Forum
Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: TomLudwig am 20.01.06 - 10:37:53
-
Hallo zusammen,
ich habe ein Problem. Ich möchte per Agent in jede ankommende Mail ein Feld hinzufügen. Bei folgendem Code werden leider auch schon abgearbeitete Mails nocheinmal abgearbeitet.
Sie sind also in den 'UnprocessedDocuments' noch vorhanden. Wie kann das verhindert werden?
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set col = db.UnprocessedDocuments
Set doc = col.GetFirstDocument
While Not doc Is Nothing
If doc.HasItem( "Unprocessed" ) = False Then
doc.Unprocessed = "1"
End If
Call doc.Save(True, False, True) ' Dokument speichern als bearbeitet
Set doc = col.GetNextDocument(doc)
Wend
End Sub
Der Agent läuft "Nach Eingang neuer Mail".
Vielen Dank für eure Hilfe.
Gruß, Tom
-
Indem Du überprüfst, ob "Dein" Feld schon vorhanden ist?
-
Hier ein kleiner Auszug aus der Hilfe zu "UnprocessedDocuments"
For agents that run on new and modified documents, newly received mail documents, pasted documents, or newly modified documents, you must use the UpdateProcessedDoc method in NotesSession to mark each document as "processed," which ensures that a document gets processed by the agent only once (unless it's modified, mailed, or pasted again). If you do not call this method for each document, the agent processes the same documents the next time it runs.
-
Hat funktioniert.
Vielen Dank, ascabg