.UnRead Property Not Updating

  • Thread starter Thread starter kris b.
  • Start date Start date
K

kris b.

I've been struggling with an Outlook Com Addin when
Outlook is configured for "Internet Only" using MAPI
and "Corporate or Workgroup" configuration using an
Exchange server.

The problem is when you open an email, regardless of
its "UnRead" status, then close that email, mark the
message as unread, and open the email again, the message
remains unread, i.e. bold font and closed envelop icon,
or, depending on which mail mode Outlook is configured for
at the time, the icon doesn't change when opening or
marking the message read/unread. This only happens to
emails that have been processed by the following code:

Dim objNS As Outlook.NameSpace
Dim objInBox As Outlook.MAPIFolder
Dim curItems As Integer

objNS = golApp.GetNamespace("MAPI")
objInBox = objNS.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderInbox)

For curItems = 1 To objInBox.Items.Count
Debug.WriteLine(objInBox.Items.Item
(curItems).FlagStatus())
Debug.WriteLine(objInBox.Items.Item
(curItems).OriginatorDeliveryReportRequested)
Debug.WriteLine(objInBox.Items.Item
(curItems).Sensitivity)
Next

Whenever this code is ran, on start up or as a triggered
event, the problem appears. In "Internet Only" mode using
MAPI protocol it's even worse, if just one of the 3 lines
in the For...Next is ran the problem appears, of the 64
Outlook.MailItem properties only 3, MessageClass, Subject
and UnRead, do not cause this error. Closing and opening
outlook makes the problem disappears, until the above code
is ran again.

This has been reproducible under Outlook 2000 and 2002 on
different machines running Windows 2000, it does not
happen in Outlook's VBA.

I've looked through Microsoft's MSDN, Knowledge Base and
various other Outlook VB programming websites and found no
information on this issue.

I'm going nuts! Please help!
 
Back
Top