MAPIFolder.UnReadItemCount not working

  • Thread starter Thread starter David E. Battey
  • Start date Start date
D

David E. Battey

If I do the following:

Dim inbox as MAPIFolder
set inbox = Application.Session.Folders(1).Folders("Inbox")
MsgBox inbox.UnReadItemCount

I get zero for the unread item count, no matter how many unread items are in
my inbox folder. I get the same behavior for all other folders, too.

Can someone tell me what I'm doing wrong?

Thanks,
David
 
Are you actually getting the Inbox? Have you tried:
set inbox = Application.GetNamespace("MAPI"). _
GetDefaultfolder(olFolderInbox)
 
That solved my problem. Thanks a million.

I'm still confused by the MAPIFolder object that I was getting with "set
inbox = Application.Session.Folders(1).Folders("Inbox")
". It contained the subfolders that I expected, but the unread item count
didn't work. Weird, but not important at this point.

- David
 
As a matter of curiosity you could get both folders and their
EntryID's and StoreID's (Item.Parent.StoreID) and compare them using
the CDO Session.CompareIDs method to see if you are actually getting
the same folder in the same InfoStore. Or you could use debug.print to
output the values and manually compare them.
 
Back
Top