Checking for missing properties in a Restrict method filter string

  • Thread starter Roger Henn via OfficeKB.com
  • Start date

R

Roger Henn via OfficeKB.com

I'm trying to use the Restrict method to filter an Items collection based on the NoAging property, but some of the MailItems don't have a NoAging property. I want to get any item with NoAging of False, or without the property at all.

I've tried "Not([NoAging] = True)", but it looks like the missing property always gives a False (or Null) result, even if you precede it with a Not. There doesn't seem to be any way to test for Null in a filter string expression ("IsNull([NoAging])" results in an invalid condition error).

Anyone got any ideas how to??
 
Ad

Advertisements

J

Jim Vierra

This works for the Inbox with no exceptions

Dim f As MAPIFolder
Dim n As NameSpace
Set n = Application.GetNamespace("mapi")
Set f = n.GetDefaultFolder(olFolderInbox)
f.Items.Restrict ("[NoAging] = False")
 
Ad

Advertisements

M

Michael Bauer

Hi Roger,

a MailItem´s MessageClass is "IPM.Note". I suppose the items with no
NoAging property have a different MessageClass property. If so then you
can restrict for (MessageClass="IPM.Note" and NoAging=False).

Or, much better, restrict for MessageClass <> the class with no NoAging.

--
Viele Grüße
Michael Bauer


Roger Henn via OfficeKB.com said:
I'm trying to use the Restrict method to filter an Items collection
based on the NoAging property, but some of the MailItems don't have a
NoAging property. I want to get any item with NoAging of False, or
without the property at all.
I've tried "Not([NoAging] = True)", but it looks like the missing
property always gives a False (or Null) result, even if you precede it
with a Not. There doesn't seem to be any way to test for Null in a
filter string expression ("IsNull([NoAging])" results in an invalid
condition error).
 

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

Top