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

Handling of Double or Single Quotation Marks in ConversationTopic



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 20th 08, 10:14 AM posted to microsoft.public.outlook.program_addins
RN
external usenet poster
 
Posts: 10
Default Handling of Double or Single Quotation Marks in ConversationTopic

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
  #2  
Old April 21st 08, 02: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


  #3  
Old April 22nd 08, 02:34 AM posted to microsoft.public.outlook.program_addins
PGS123
external usenet poster
 
Posts: 5
Default Handling of Double or Single Quotation Marks in ConversationTo

Hi Ken,

I did. What I did was to detect the presence of single quote in
ConversationTopic then I will use double quotes in my Restrict criteria. And
if I detected the presence of double quote in ConversationTopic then I will
use single quotes in my Restrict criteria. This works out well. But the
problem is when both the single and double quotes are present in
ConversationTopic then I don't know how to write my Restrict criteria.

Regards,
Robin

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

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



  #4  
Old April 22nd 08, 02:56 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 ConversationTo

Hmmm. Have you tried doubling up any single quotes to escape them when
they're in the EmailSubject string? Then you could try just using single
quotes surrounding the EmailSubject part of the restriction.

string test = EmailSubject;

// first clause has single quote within double quotes,
// second clause has 2 single quotes within double quotes.
EmailSubject = test.Replace("'", "''");

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


"PGS123" wrote in message
...
Hi Ken,

I did. What I did was to detect the presence of single quote in
ConversationTopic then I will use double quotes in my Restrict criteria.
And
if I detected the presence of double quote in ConversationTopic then I
will
use single quotes in my Restrict criteria. This works out well. But the
problem is when both the single and double quotes are present in
ConversationTopic then I don't know how to write my Restrict criteria.

Regards,
Robin


  #5  
Old April 23rd 08, 04:41 AM posted to microsoft.public.outlook.program_addins
PGS123
external usenet poster
 
Posts: 5
Default Handling of Double or Single Quotation Marks in ConversationTo

No luck. I think the problem here is the property of ConversationTopic is
readonly. Even if it is a read/write property it will be a hassle to replace
each and everyone of the same ConversationTopic due to performance issues.
Another issue is that the Restrict method will hunt for all identical
ConversationTopic in Outlook folders and thus changing a particular instance
of the ConversationTopic will not help.

Robin


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

Hmmm. Have you tried doubling up any single quotes to escape them when
they're in the EmailSubject string? Then you could try just using single
quotes surrounding the EmailSubject part of the restriction.

string test = EmailSubject;

// first clause has single quote within double quotes,
// second clause has 2 single quotes within double quotes.
EmailSubject = test.Replace("'", "''");

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


"PGS123" wrote in message
...
Hi Ken,

I did. What I did was to detect the presence of single quote in
ConversationTopic then I will use double quotes in my Restrict criteria.
And
if I detected the presence of double quote in ConversationTopic then I
will
use single quotes in my Restrict criteria. This works out well. But the
problem is when both the single and double quotes are present in
ConversationTopic then I don't know how to write my Restrict criteria.

Regards,
Robin



  #6  
Old April 23rd 08, 02:27 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 ConversationTo

I wasn't suggesting trying to change the read-only ConversationTopic
property. I was suggesting trying massaging the EmailSubject variable that
way. Other than that I have no other suggestions.

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


"PGS123" wrote in message
...
No luck. I think the problem here is the property of ConversationTopic is
readonly. Even if it is a read/write property it will be a hassle to
replace
each and everyone of the same ConversationTopic due to performance issues.
Another issue is that the Restrict method will hunt for all identical
ConversationTopic in Outlook folders and thus changing a particular
instance
of the ConversationTopic will not help.

Robin


  #7  
Old April 24th 08, 01:40 AM posted to microsoft.public.outlook.program_addins
PGS123
external usenet poster
 
Posts: 5
Default Handling of Double or Single Quotation Marks in ConversationTo

Hi Ken,

It's ok. Thanks for your help thus far.

Robin

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

I wasn't suggesting trying to change the read-only ConversationTopic
property. I was suggesting trying massaging the EmailSubject variable that
way. Other than that I have no other suggestions.

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


"PGS123" wrote in message
...
No luck. I think the problem here is the property of ConversationTopic is
readonly. Even if it is a read/write property it will be a hassle to
replace
each and everyone of the same ConversationTopic due to performance issues.
Another issue is that the Restrict method will hunt for all identical
ConversationTopic in Outlook folders and thus changing a particular
instance
of the ConversationTopic will not help.

Robin



 




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
Senders putted in quotation marks D Outlook - General Queries 1 May 25th 07 12:47 PM
Double vs Single line spacing copy paste Outlook 2003 to/from Text Editors JDJ Outlook - General Queries 0 December 21st 06 08:06 PM
Sending emails - Single Quote Marks Before/After Contact Name Vrmwolf Outlook - Using Contacts 2 April 5th 06 03:09 PM
Single v.s. double-spacing in OE 6 don Outlook Express 6 March 2nd 06 03:58 PM
Quotation marks around Contact Names [email protected] Outlook - General Queries 0 January 15th 06 09:09 AM


All times are GMT +1. The time now is 07:12 AM.


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