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 Forms / December 2003

Tip: Looking for answers? Try searching our database.

Outlook OM : Method Restrict() has problems with parentheses

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tsfreaks - 08 Dec 2003 21:36 GMT
I'm trying to filter for a specific name using;
olItems.Restrict("[From] = John Doe()");

Notice the parentheses in the string. If the string
contains parentheses in it, I get the following exception.

An unhandled exception of
type 'System.Runtime.InteropServices.COMException'
occurred in ioemail.dll
Additional information: Condition is not valid.

How do I get Restrict to work with parentheses?
tsfreaks - 09 Dec 2003 18:55 GMT
Answer:
olItems.Restrict("[From] = 'John Doe()'");
>-----Original Message-----
>I'm trying to filter for a specific name using;
[quoted text clipped - 11 lines]
>
>.
Anita Gupta - 30 Dec 2003 17:40 GMT
If noticed that if the name contains an apostrophe such as: John O'Malley
this will cause problems with the search string. The only what that I've
figured out how to do it is with a construct such as:

olItems.Restrict("[From] = ""'John O'Malley()'""")

If you want to use a variable such as:
myVariable = "John O'Malley()"

Then you'd use a construct such as:
olItems.Restrict("[From] = """ & myVariable & """")

Anita

> Answer:
> olItems.Restrict("[From] = 'John Doe()'");
[quoted text clipped - 14 lines]
> >
> >.
 
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.