restrict coversationtopic fails

Y

Yaz

First of all, sorry for cross posting, but there are great resources in both
forums and it's better than posting two separate posts.

I am running into a problem with the CoversationTopic filter for the
Restrict method on Items. I am using this method to retrieve a list of all
items in a thread so that I can either flag it or delete it. I am using it
as follows:

set TopicItems =
activeexplorer.CurrentFolder.Items.Restrict("[ConversationTopic]=" &
CurrentItem.ConversationTopic)

What I am finding is that this fails for emails that have special characters
such as "&" and " ' " (single quote).

Can anyone suggest anything different / identify what I am doing wrong?

Thanks,

Yasmeen
 
Y

Yaz

Clarification:

Following statement will fail on "&" in the subject line
set TopicItems = activeexplorer.CurrentFolder.Items.Restrict("[ConversationTopic]=" &
CurrentItem.ConversationTopic)

Following statement will fail on " ' " (single quote) in the subject line
set TopicItems = activeexplorer.CurrentFolder.Items.Restrict("[ConversationTopic]='" &
CurrentItem.ConversationTopic &"'")
Any ideas on how to make it work for both scenarios?

Thanks in advance.

- Yasmeen
 
M

Michael Bauer

Hi Yasmeen,

please use the second one with Chr(34) instead of a single quote.

--
Viele Grüße
Michael Bauer - MVP Outlook


Clarification:

Following statement will fail on "&" in the subject line
set TopicItems =
activeexplorer.CurrentFolder.Items.Restrict("[ConversationTopic]=" &
CurrentItem.ConversationTopic)

Following statement will fail on " ' " (single quote) in the subject
line
set TopicItems =
activeexplorer.CurrentFolder.Items.Restrict("[ConversationTopic]='" &
CurrentItem.ConversationTopic &"'")
Any ideas on how to make it work for both scenarios?

Thanks in advance.

- Yasmeen
 
Y

Yaz

Thanks! That worked!

Michael Bauer said:
Hi Yasmeen,

please use the second one with Chr(34) instead of a single quote.

--
Viele Grüße
Michael Bauer - MVP Outlook


Clarification:

Following statement will fail on "&" in the subject line
set TopicItems =
activeexplorer.CurrentFolder.Items.Restrict("[ConversationTopic]=" &
CurrentItem.ConversationTopic)

Following statement will fail on " ' " (single quote) in the subject
line
set TopicItems =
activeexplorer.CurrentFolder.Items.Restrict("[ConversationTopic]='" &
CurrentItem.ConversationTopic &"'")
Any ideas on how to make it work for both scenarios?

Thanks in advance.

- Yasmeen


Yaz said:
First of all, sorry for cross posting, but there are great resources in both
forums and it's better than posting two separate posts.

I am running into a problem with the CoversationTopic filter for the
Restrict method on Items. I am using this method to retrieve a list of all
items in a thread so that I can either flag it or delete it. I am using it
as follows:

set TopicItems =
activeexplorer.CurrentFolder.Items.Restrict("[ConversationTopic]=" &
CurrentItem.ConversationTopic)

What I am finding is that this fails for emails that have special characters
such as "&" and " ' " (single quote).

Can anyone suggest anything different / identify what I am doing wrong?

Thanks,

Yasmeen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top