A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Restrict() method and Null values



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 16th 08, 05:11 AM posted to microsoft.public.outlook.program_addins
Craig Buchanan[_2_]
external usenet poster
 
Posts: 12
Default Restrict() method and Null values

I am trying to get a list of contacts (using the Restict() method) in a
Outlook 2003 Contact folder that do NOT have an Email1Address assigned.

These (Jet?) queries do NOT eliminate contacts without an Email1Address:

[Email1Address] ''
NOT([Email1Address] = '')
NOT([Email1Address] IS NULL) 'plus lower-case variations
"[Email1Address]" & Chr(34) & Chr(34)

Email1Address that are missing are considered Nothing in the Immediate
window, btw.

I'm using .Net framework 2.0. I am testing in Offline mode, if that makes a
difference.

Can someone shed some light on this for me?

Thanks,

Craig Buchanan


Ads
  #2  
Old December 16th 08, 03:29 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Restrict() method and Null values

You can use a DASL query for that using the undocumented "@SQL=" prefix.
Using that syntax your query for only items with an Email1Address would look
like this in VB.NET:

Dim sFilter As String = "@SQL=NOT(urn:schemas:contacts:email1 IS NULL)"

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Craig Buchanan" wrote in message
...
I am trying to get a list of contacts (using the Restict() method) in a
Outlook 2003 Contact folder that do NOT have an Email1Address assigned.

These (Jet?) queries do NOT eliminate contacts without an Email1Address:

[Email1Address] ''
NOT([Email1Address] = '')
NOT([Email1Address] IS NULL) 'plus lower-case variations
"[Email1Address]" & Chr(34) & Chr(34)

Email1Address that are missing are considered Nothing in the Immediate
window, btw.

I'm using .Net framework 2.0. I am testing in Offline mode, if that makes
a difference.

Can someone shed some light on this for me?

Thanks,

Craig Buchanan


  #3  
Old December 16th 08, 04:48 PM posted to microsoft.public.outlook.program_addins
Craig Buchanan
external usenet poster
 
Posts: 3
Default Restrict() method and Null values

Ken-

Thanks for the reply.

Why don't Jet queries support IS NULL or ''?

Thanks,

Craig

"Ken Slovak - [MVP - Outlook]" wrote:

You can use a DASL query for that using the undocumented "@SQL=" prefix.
Using that syntax your query for only items with an Email1Address would look
like this in VB.NET:

Dim sFilter As String = "@SQL=NOT(urn:schemas:contacts:email1 IS NULL)"

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Craig Buchanan" wrote in message
...
I am trying to get a list of contacts (using the Restict() method) in a
Outlook 2003 Contact folder that do NOT have an Email1Address assigned.

These (Jet?) queries do NOT eliminate contacts without an Email1Address:

[Email1Address] ''
NOT([Email1Address] = '')
NOT([Email1Address] IS NULL) 'plus lower-case variations
"[Email1Address]" & Chr(34) & Chr(34)

Email1Address that are missing are considered Nothing in the Immediate
window, btw.

I'm using .Net framework 2.0. I am testing in Offline mode, if that makes
a difference.

Can someone shed some light on this for me?

Thanks,

Craig Buchanan



  #4  
Old December 16th 08, 05:04 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Restrict() method and Null values

Why's the sky blue? g

Jet queries do support that sort of thing and in VBA code I'd use something
like this:

"[Email1Address] " & Chr(34) & Chr(34)

However in .NET code I've found many cases where a property is not there
even if in VBA code it would be null string. It might be null string or null
(Nothing) in .NET code. So for me it's a lot easier to avoid that possible
problem and to just use DASL syntax for the search. Personal preference plus
some experience.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Craig Buchanan" wrote in message
...
Ken-

Thanks for the reply.

Why don't Jet queries support IS NULL or ''?

Thanks,

Craig


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NULL event item ? Mark Beiley Add-ins for Outlook 0 September 19th 07 12:46 AM
Restrict Method - Find only blank fields - VBA Irene Outlook and VBA 1 June 5th 07 05:25 PM
Using Restrict method to select emails Jerry West Outlook and VBA 16 April 26th 07 06:48 PM
Restrict method problem Mike Epp Outlook and VBA 2 April 7th 06 08:03 PM
Restrict Method DNW emanson Outlook and VBA 14 March 28th 06 06:47 AM


All times are GMT +1. The time now is 08:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.