按日期从已发送视图 Lotus Notes 中删除的脚本

按日期从已发送视图 Lotus Notes 中删除的脚本

有谁知道如何修改下面的脚本以按指定日期从已发送视图中删除。以下是 iBM 标准脚本,需要修改为按日期而不是按天删除。基本上我需要一个脚本来删除指定日期之前的所有已发送邮件。任何帮助都将不胜感激。

Sub Initialize
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim nextdoc As NotesDocument
    Dim lastmodifieddate As New NotesDateTime("")
    Dim modifieddate As Variant
    Dim days As Integer

    Set db = s.CurrentDatabase
    Set view = db.GetView("$Sent")
    Set doc = view.GetFirstDocument

    While Not ( doc Is Nothing )
        Set nextdoc = view.getnextdocument(doc)
        modifieddate=Evaluate("@Modified", doc)
        lastmodifieddate.lslocaltime= CDat(modifieddate(0))
        days = CInt( Date - lastmodifieddate.lslocaltime )
        'Change the number of days from 30 below as desired
        If days > 30 Then 
            Call doc.Remove(True)
            'In Notes 6.0 and later you can use the below instead of the above 
            'if you want to hard delete the document
            'Call doc.RemovePermanently(True)
        End If 
        Set doc = nextdoc 
    Wend 
End Sub

答案1

类似这样的事应该可以

Sub Initialize
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim nextdoc As NotesDocument
    Dim lastmodifieddate As New NotesDateTime("")
    Dim modifieddate As Variant
    Dim days As Integer

    Dim checkdate as Variant

    Set db = s.CurrentDatabase
    Set view = db.GetView("$Sent")
    Set doc = view.GetFirstDocument

    checkdate = DateNumber(2018, 02, 25)

    While Not ( doc Is Nothing )
        Set nextdoc = view.getnextdocument(doc)
        modifieddate=Evaluate("@Modified", doc)

        If  modifieddate < checkdate Then 
            Call doc.Remove(True)
            'In Notes 6.0 and later you can use the below instead of the above 
            'if you want to hard delete the document
            'Call doc.RemovePermanently(True)
        End If 
        Set doc = nextdoc 
    Wend 
End Sub

相关内容