View Single Post
  #2  
Old April 21st 08, 03:33 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Handling of Double or Single Quotation Marks in ConversationTopic

Test it both ways using an OR clause.

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


"RN" wrote in message
...
Hi,

I have an issue here in using the Restrict method to confine my result set
to a specific topic. In both cases below EmailSubject is a string passed
in
to a method that handle the statement.

Case 1 (use of escaped double quotes in search string):
MyMailItems = SelectedFolder.Items.Restrict("[ConversationTopic]=\"" +
EmailSubject + "\"");
--- This will fail if there is any double quotation mark in the
ConversationTopic field.

Whereas

Case 2 (use of single quotation mark in search string):
MyMailItems = SelectedFolder.Items.Restrict("[ConversationTopic]='" +
EmailSubject + "'");
--- This will fail if there is any single quotation mark in the
ConversationTopic field.

Both Case 1 and Case 2 work fine if there is no single or double quotation
marks present in the ConversationTopic field.

So I got a problem in either case. Does anyone have any suggestion in
handling or bypassing the presence of either the double or the single
quotation marks in ConversationTopics?

Thanks.
Robin


Ads