Hi,
Newbie here trying to write a script that runs when I click to open a folder, inside the "queryopen" event, which will delete any old emails that have the same subject as the new email that just came in. I have the folder sorted by date desc.
The "subj = doc.Subject" line is failing though, and I can't figure out why. Does anyone have a script which will delete older emails with the same subject, or does anyone see what's wrong with this one?
Thanks,
Mike
Newbie here trying to write a script that runs when I click to open a folder, inside the "queryopen" event, which will delete any old emails that have the same subject as the new email that just came in. I have the folder sorted by date desc.
Code:
Sub Queryopen(Source As Notesuiview, Continue As Variant)
Dim s As New NotesSession
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim subj As String
Set dc = Source.Documents
Set doc = dc.GetFirstDocument
subj = doc.Subject
Do Until (doc Is Nothing)
Set doc = dc.GetNextDocument(doc)
If doc.Subject = subj Then
Msgbox(subj)
'doc.DeletedBy = s.CommonUserName
'doc.DeletedOn = Now
'Call Doc.Save(True, False)
End If
Loop
End Sub
The "subj = doc.Subject" line is failing though, and I can't figure out why. Does anyone have a script which will delete older emails with the same subject, or does anyone see what's wrong with this one?
Thanks,
Mike