WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE and Outlook
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Mark Messages as Read in Outlook using OLE

 Keywords:  

Question:

Hi, I am trying read messages from outlook's inbox using OLE, that I know how to do. How do I mark the message as read so the next time I read the inbox I do not pick up the same messages as before?

Answer:

Not sure. You might try something like this..
objitem.unread = @false
The following code works for me.
olFolderInbox=6 ;constant DO NOT CHANGE

MSapp = ObjectOpen ("Outlook.Application")

objNameSpace = MSapp.GetNamespace("MAPI")

objFolder = objNameSpace.GetDefaultFolder(olFolderInbox);  'Access the Inbox

objFolder.Display

objcount=objFolder.Items

mycount=objcount.Count;checks number of messages in inbox!

For xx = 1 to mycount 

  objitem=objFolder.Items(xx)

  myText = objitem.Subject
  objitem.UnRead = @False

  message(StrCat("Message with subject: ",mytext), "Marked as Read")

Next

ObjectClose(MSapp)

exit

Article ID:   W16093
File Created: 2004:03:30:15:42:50
Last Updated: 2004:03:30:15:42:50