PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins How to Restrict on NULL values

Reply

How to Restrict on NULL values

 
Thread Tools Rate Thread
Old 01-07-2003, 10:43 PM   #1
Terry Lindeman
Guest
 
Posts: n/a
Default How to Restrict on NULL values


The following code is supposed to retrieve all messages where Mileage does
not have the value "done".

Set cNewItems = InFolder.Items.Restrict("[Mileage] <> ""done""")

It retrieves messages with Mileage = "", but not messages with Mileage =
NULL. This seems to be a problem with Exchange moret than POP3. In SQL, I
could just say:

select * from message where mileage <> 'done' or mileage is null

Requesting Mileage = "" will get the blank ones, but not the null ones. Is
there a way to request null values in a Restrict clause?

Terry Lindeman




  Reply With Quote
Old 02-07-2003, 08:50 PM   #2
Terry Lindeman
Guest
 
Posts: n/a
Default Re: How to Restrict on NULL values

Ken:

For a mail item, I assume this initialization to "" should be done in the
ItemAdd event for the InFolder. Are there any cases where that's not
possible? I've seen comments in newsgroups that items in the InFolder are
sometimes considered read-only.

"Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> wrote in message
news:%23d0ZoQKQDHA.3016@TK2MSFTNGP10.phx.gbl...
> For the most part fields that are Null aren't even in the items, the
> fields are only created in the item when a data value has been
> assigned to it. I always init any fields I'm interested in as "" so I
> don't run into that problem if I'm using a restriction.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning VB 6 Application Development, Wrox Press
> Attachment Options
> http://www.slovaktech.com/attachmentoptions.htm
> Extended Reminders
> http://www.slovaktech.com/extendedreminders.htm
>
>
> "Terry Lindeman" <terryl@no-spam-datagem.com> wrote in message
> news:OzSU7ICQDHA.3144@tk2msftngp13.phx.gbl...
> > The following code is supposed to retrieve all messages where

> Mileage does
> > not have the value "done".
> >
> > Set cNewItems = InFolder.Items.Restrict("[Mileage] <> ""done""")
> >
> > It retrieves messages with Mileage = "", but not messages with

> Mileage =
> > NULL. This seems to be a problem with Exchange moret than POP3. In

> SQL, I
> > could just say:
> >
> > select * from message where mileage <> 'done' or mileage is null
> >
> > Requesting Mileage = "" will get the blank ones, but not the null

> ones. Is
> > there a way to request null values in a Restrict clause?
> >
> > Terry Lindeman
> >
> >
> >
> >

>
>



  Reply With Quote
Old 03-07-2003, 08:38 PM   #3
Terry Lindeman
Guest
 
Posts: n/a
Default Re: How to Restrict on NULL values

Ken:

This is an anti-spam application, so the idea is to avoid viewing the
messages..

ItemAdd is the perfect place for this, but I'm concerned that a POP3 user
may fire up Outlook and receive 100 spams all at once, so it sounds like
some of them might not get processed.

Do you have any data regarding how often this missed ItemAdd event might
occur? I guess a periodic timer event would be required.

Terry

"Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> wrote in message
news:u%23EiTgXQDHA.2224@TK2MSFTNGP12.phx.gbl...
> ItemAdd might not fire if there are too many items added at one time
> to the folder. What I would use is the NewInspector event to catch a
> new mail item being opened and use Inspector.CurrentItem to get the
> mail item. Then I'd add the fields.
>
> If the item wasn't opened but viewed in the preview pane you can use
> Item.Read but you'd have to instantiate an Explorer.Selection
> collection and when the selection changes instantiate items so
> Item.Read would fire as an event you can handle.
>
> If you want a property on all items whether they have been opened or
> not you can use ItemAdd on the Items collection of the Inbox or you
> can sweep the folder at intervals using a timer control to set the
> intervals and check for the property you want on all the items in the
> folder.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning VB 6 Application Development, Wrox Press
> Attachment Options
> http://www.slovaktech.com/attachmentoptions.htm
> Extended Reminders
> http://www.slovaktech.com/extendedreminders.htm
>
>
> "Terry Lindeman" <terryl@no-spam-datagem.com> wrote in message
> news:OZYgfuNQDHA.2460@TK2MSFTNGP10.phx.gbl...
> > Ken:
> >
> > For a mail item, I assume this initialization to "" should be done

> in the
> > ItemAdd event for the InFolder. Are there any cases where that's

> not
> > possible? I've seen comments in newsgroups that items in the

> InFolder are
> > sometimes considered read-only.

>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off