Mark email as read

  • Thread starter Fausto Richetti Blanco
  • Start date
F

Fausto Richetti Blanco

I use some email messages, with a specific subject, to control a
workflow
system in outlook. So, these emails are consumed by the application on
the
NewMail event and deleted. But the email remain as unread and in the
trash
folder...
Is there a way to mark these emails as read or, if possible,
definitively
delete the messages (ie.: remove them from the trash folder) ?
 
K

Ken Slovak - [MVP - Outlook]

Try releasing your reference to the object and getting it back from the
EntryID and then marking it read twice.

To delete an item permanently without hitting the Deleted Items folder you
would have to delete it using CDO 1.21 or Extended MAPI or Redemption
(www.dimastr.com/redemption). Or you could iterate the Deleted Items folder
and delete all items or yours using code.
 
F

Fausto Richetti Blanco

Thanks, the following code solved my problem:
For Each auxDeletedItem In
hndOutlook.GetNamespace("MAPI").GetDefaultFolder(olFolderDeletedItems).Items
If (auxDeletedItem.Class = olMail) Then
If (auxDeletedItem.Subject = ctrlSubject) Then
auxDeletedItem.Delete
End If
End If
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top