Link to home
Start Free TrialLog in
Avatar of Hoboly
Hoboly

asked on

Unable to delete email from trash

attached the source code in vb.net 2003 calling lotus domino 6.5.4

no errors...

Thanks for help~
Public Function emptyTrash()
        open()
        Dim nDateTime As NotesDateTime = domS.CreateDateTime("")
        nDateTime.SetNow()
        nDateTime.AdjustMinute(DETECT_EMAIL_WITHIN_MIN)
 
        Dim dc As NotesView = domDB.GetView("($Trash)")
        Call domDB.EnableFolder("$Trash)")
 
        Dim dViewEntry As NotesViewEntryCollection = dc.AllEntries
        Dim counter As Integer
        Dim dEntry As NotesViewEntry
        Dim dDoc As NotesDocument
 
        For counter = 1 To dViewEntry.Count
 
            dEntry = dViewEntry.GetNthEntry(counter)
            dDoc = dEntry.Document
            ' If dDoc.DeliveredDate(0) < nDateTime.LSLocalTime Then
            dDoc.RemoveFromFolder("($Trash)")
            dDoc.Remove(True)
            'End If
 
        Next
 
        Call dc.Refresh()
 
 
        'Dim dc As NotesDocumentCollection = domDB.Search("VIEW = (\$Trash)", nDateTime, 0)
        'Dim domDoc As NotesDocument = dc.GetFirstDocument
        'Dim domDocDel As NotesDocument
        'While Not (domDoc Is Nothing)
        '    domDocDel = Nothing
        '    domDocDel = domDoc
        '    domDoc = dc.GetNextDocument(domDoc)
        '    If domDocDel Is Nothing = False Then
        '        domDocDel.RemoveFromFolder("($Trash)")
        '    End If
 
        'End While
 
        nDateTime = Nothing
        dc = Nothing
        domDocDel = Nothing
        domDoc = Nothing
 
        close()
    End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hoboly
Hoboly

ASKER

Thanks!

what is Call dc.AutoUpdate= False, by the way?
Well... actually, it's plain wrong :-)  It should have been

      dc.AutoUpdate= False

It prevents the view from updating itself while you're using it. Updating is a waste of time, you're going to delete all documents in it anyway.