Joe O'Connell
joeo at appoli.com
Mon Nov 16 08:26:38 CST 2009
What is the proper way to use Redemption to move email messages from the
inbox to the deleted items folder?
An Access 2003 application had been using Outlook objects to read each
email in the inbox, process it, and then delete it. The delete behaved
just like Outlook - the email was moved to the deleted items folder.
Requirements changed and properties needed to be accessed that caused
the "confirmation" message box to be displayed. To eliminate the
message box, the code was changed to use Redemption. The processing of
the emails is working properly, but the delete now deletes the emails
completely from Outlook instead of moving them to the deleted items
folder. Business rules require all email messages to be retained for a
specific period of time after being processed.
Here is the relevant code:
Dim i As Integer
Dim lngNumItems As Long
Dim Session As Object, Folder As Object, olItems As Object
Set Session = CreateObject("Redemption.RDOSession")
Session.Logon
Set Folder = Session.GetDefaultFolder(olFolderInbox)
lngNumItems = Folder.Items.Count
Set olItems = Folder.Items
If lngNumItems > 0 Then
For i = 1 To lngNumItems
.... process email, works OK .......
Next i
For i = lngNumItems To 1 Step -1
olItems(i).Delete
Next i
End If
Any help on how to change the "olItems(i).Delete" statement to move the
email to the deleted items folder is greatly appreciated.
Joe O'Connell