Find all messages with specific message class

  • Thread starter Thread starter Mike Jipson
  • Start date Start date
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
 
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
 
Back
Top