Setting Restrict for NoAging property, resolved


Greg J

Hi there,

I am not looking for resolution, in fact I have found something I wish
to share. Perhaps some of the experts might be able to validate it or
even provide the reasons why. I have seen a couple of posts here
hinting at this problem but from what I can see, it wasnt resolved.

I have been trying to get my app to correctly determine the number of
Items in a folder that have their NoAging property set to False, or
more accurately, Not set to True (as I wish to ignore the items that
are set as "Do Not Archive". NoAging=True means "Do Not Archive").

Interestingly, I ran into the problem where the Restrict method of the
items collection was returning the incorrect number of items when I set
NoAging=False. For example, in my Inbox, there were 69 messages, the
Restrict filter returned 38 that were NoAging=False and 0 that were
NoAging=True. One would assume the the sum of these two filters should
be the total of the items in the folder. Not so (obviously).

Even more interestingly, if I iterated through each item in the
collection (eg For Each itm in MyItems) and counted True vs False ofr
the NoAging property, I ended up with 69 messages that returned False
and 0 that returned True (which is the correct result).
From what I can glean from these groups and other sources, all items
support the NoAging property but it does not necessarily exist on all
items. So where you are looking at the item itself, if the property
doesn't exist the value defaults to False. When you are looking at the
items collection, this doesnt happen so the Restrict method will not
return items that do not have the property.

So, the way to get the Restrict filter to acknowledge these messages
that do not have a NoAging property is to set the filter as:

"NoAging=False OR (NoAging<>False AND NoAging<>True)"

This correctly returns the number of items in the collection that are
NOT set to TRUE. (ie: those items NOT set to "Do Not Archive").



Michael Bauer [MVP - Outlook]

Am 23 Oct 2006 06:54:10 -0700 schrieb Greg J:

That´s very interesting, thank you.

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