Restricting or Finding Contact items

  • Thread starter Thread starter Kristian
  • Start date Start date
K

Kristian

Hello,
I'm trying to write code to create distribution lists.
I want to be able to choose what to create a DL from so I
have a small form that lets the user choose some
parameters. All parameters are user defined:
[ContResp] = Contact responsible
[EngInfo] = The contact prefers info in English
[Camp] = A marketing campaign
So,if he wants, the user can create a DL
for all contacts of a chosen campaign,
for all contacts of one employee (Contact responsible),
for all contacts that prefer Swedish or English,
or a combination of these.

It seemed easy enough, but I can't get the Restrict (and
not the Find/FindNext method(s) to work.
Not working 1:
Set oSvItms = _
oItms.Restrict("[UserProperties(""EngInfo"")] = 'False'")
Not working 2:
Set oSvItms = _
oItms.Restrict("[EngInfo] = 'False'")
Although it seems to be "on the right track";
No matter what value i put inside the filter condition,
the resulting collection always returns five items
(which is the number of English preferring contacts)...
Not working 3:
Set itm = oItms.Find("[EngInfo]=Falskt")
Do Until TypeName(itm) = "Nothing"
Set SvItem = oSvItms.Add
Set SvItem = itm
Set itm = oItms.FindNext
Loop
?oSvItms.Count in the immediate window returns 0...

I would appreciate any help,
TiA,
Kristian
 
What kind of property is EngInfo? Your code makes it look like it's a string, but I bet it's Boolean, in which case you'd need to use:

oItms.Restrict("[EngInfo] = False")

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Of Course!
Thanks Sue (Your patience with me is impressive!)

From: Sue Mosher [MVP]
Date Posted: 12/10/2003 7:55:00 PM



What kind of property is EngInfo? Your code makes it look like it's a
string, but I bet it's Boolean, in which case you'd need to use:

oItms.Restrict("[EngInfo] = False")

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers



Kristian said:
Hello,
I'm trying to write code to create distribution lists.
I want to be able to choose what to create a DL from so I
have a small form that lets the user choose some
parameters. All parameters are user defined:
[ContResp] = Contact responsible
[EngInfo] = The contact prefers info in English
[Camp] = A marketing campaign
So,if he wants, the user can create a DL
for all contacts of a chosen campaign,
for all contacts of one employee (Contact responsible),
for all contacts that prefer Swedish or English,
or a combination of these.

It seemed easy enough, but I can't get the Restrict (and
not the Find/FindNext method(s) to work.
Not working 1:
Set oSvItms = _
oItms.Restrict("[UserProperties(""EngInfo"")] = 'False'")
Not working 2:
Set oSvItms = _
oItms.Restrict("[EngInfo] = 'False'")
Although it seems to be "on the right track";
No matter what value i put inside the filter condition,
the resulting collection always returns five items
(which is the number of English preferring contacts)...
Not working 3:
Set itm = oItms.Find("[EngInfo]=Falskt")
Do Until TypeName(itm) = "Nothing"
Set SvItem = oSvItms.Add
Set SvItem = itm
Set itm = oItms.FindNext
Loop
?oSvItms.Count in the immediate window returns 0...

I would appreciate any help,
TiA,
Kristian
 
Back
Top