Find all messages with specific message class

M

Mike Jipson

Hi

Can anyone point me in the right direction on this please?

I am trying to write a VB script that scans a mailbox on a 5.5 server
looking for items of a certain (custom) message class and deleting
them as it goes.

I have written some code that gives me a MESSAGES collection for each
folder. I can then loop through each message...

Set oMessage = oMessages.getfirst
Do until oMessage Is Nothing

' How can I check the message class here?

set oMessage =oMessages.getnext
Loop


Can this be done from VB/VB Script and if so any pointers would be
great.

Cheers

Mike
 
K

Ken Slovak - [MVP - Outlook]

Always use a down counting loop or in your case GetLast then GetPrevious
since you are deleting items in the collection and the collection pointers
and count are changing as you delete.

The MessageClass of an item using CDO is the Type property, so:

If oMessage.Type = "IPM.Note.MyCustomClass" Then
oMessage.Delete
End If
 

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