Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / January 2005

Tip: Looking for answers? Try searching our database.

Questions about Restrict

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave Townsend - 26 Jan 2005 12:00 GMT
I am trying to use restrict to find a set of contacts that have at least
one fax number specified and have a setting in a user defined property.
I have phrased my query like this:

[Userprop] = True and ([HomeFaxNumber] <> "" or [BusinessFaxNumber] <>
"" or [OtherFaxNumber] <> "")

Firstly I am assuming that I can use this kind of bracketed notation, I
haven't seen any examples of it anywhere but the restrict seems to succeed.

My problem is that the bit in the brackets doesn't seem to work. How
should I be checking that there is a number in a fax property?

Dave
Ken Slovak - 26 Jan 2005 15:57 GMT
Some of those properties may not exist on the items if they were never
initialized with a value. That's probably why you aren't getting any results
for the fax fields. You might have to initialize those values to a null
string before your restriction. To see if that's the case you can do that on
a group of items and see if your restriction works any better.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

>I am trying to use restrict to find a set of contacts that have at least
>one fax number specified and have a setting in a user defined property. I
[quoted text clipped - 11 lines]
>
> Dave
Dave Townsend - 26 Jan 2005 16:24 GMT
> Some of those properties may not exist on the items if they were never
> initialized with a value. That's probably why you aren't getting any
> results for the fax fields. You might have to initialize those values to
> a null string before your restriction. To see if that's the case you can
> do that on a group of items and see if your restriction works any better.

Sorry, I should have made myself clearer. I am getting results for the
fax fields, in fact if I just use the terms in the brackets to try to
find contacts that have a fax number in one of the fax fields the
restrict method returns all the contacts, even though over 2000 of them
do not have fax numbers in any of the fax fields.

Dave
Ken Slovak - 27 Jan 2005 14:42 GMT
Well, I've seen results similar to that when I restricted on properties that
weren't there in all items, Unfortunately you can't really do something like
you can in MAPI or Redemption code where you can set a filter or restriction
on a property existing and having a certain value.

I'd try an experiment of forcing a null string as the value of the fax
fields in every item that doesn't have a value in those fields and then try
the restriction again.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

>> Some of those properties may not exist on the items if they were never
>> initialized with a value. That's probably why you aren't getting any
[quoted text clipped - 9 lines]
>
> Dave
Dave Townsend - 27 Jan 2005 16:53 GMT
> Well, I've seen results similar to that when I restricted on properties
> that weren't there in all items, Unfortunately you can't really do
[quoted text clipped - 4 lines]
> fields in every item that doesn't have a value in those fields and then
> try the restriction again.

You're right, it appears to be a problem with the fax numbers never
having been assigned anything before. Trouble is, that makes my use of
restrict pointless. The reason for restrict is so I don't have to
retrieve every item to check it matches what I look for. If I have to
retrieve every item to assign a blank string to the fax number then I
may as well just do my tests and ignore restrict.

Microsoft do like to make things easy on us don't they!

Thanks for your help.

Dave
Ken Slovak - 28 Jan 2005 15:00 GMT
If you can use Extended MAPI or are using Redemption to avoid the security
restrictions you can use a MAPI table filter or restriction and that can use
RestrictionExist as a condition for a property and has the added bonus of
running about 5 - 10 orders of magnitude faster than an Outlook restriction
or filter.

Using Redemption I'd create a RestrictionAnd, add a RestrictionExist for
that property to the RestrictionAnd and then add a RestrictionContent for
the value I wanted. For more than one property I'd create a RestrictionOr
and add a set of RestrictionAnd's with the RestrictionExist  and
RestrictionContent  for each property I wanted to qualify for the
restriction.

If I wanted to get the items from the rows of the resulting filtered
MAPITable I'd include the EntryID of the item in the row and use
NameSpace.GetItemFromID to get items I wanted to change (results of the
MAPITable.Filter are read-only from the table).

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

>> Well, I've seen results similar to that when I restricted on properties
>> that weren't there in all items, Unfortunately you can't really do
[quoted text clipped - 17 lines]
>
> Dave
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.