Acess particular outlook category only

E

Emir

Hello
My application works well in synchroizing contacts forth and back with
outlook by using functions similar to GetItemFromName, GetItemFromNames,
etc. as given in Microsofts Code Librarian. Unfortunately selectively
accessing categories with
strCriteria = "[Categories] = Test"
Set objFoundItems = fldContacts.Items.Restrict(strCriteria)
does not work.

Does anyone have a hint to give?

Thanks in advance
Walter
 
J

John Vinson

Hello
My application works well in synchroizing contacts forth and back with
outlook by using functions similar to GetItemFromName, GetItemFromNames,
etc. as given in Microsofts Code Librarian. Unfortunately selectively
accessing categories with
strCriteria = "[Categories] = Test"
Set objFoundItems = fldContacts.Items.Restrict(strCriteria)
does not work.

Does anyone have a hint to give?

I'm not familiar with the Outlook interface, but I've done more than a
few strCriteria - and if Categories is a Text datatype (as appears to
be the case) you need some syntactically required quotemarks. To find
items where the Categories field contains the literal text string
"Test" use

strCriteria = "[Categories] = 'Test'"

or, if the word Test is embedded in a longer string,

strCriteria = "[Categories] LIKE '*Test*'"


John W. Vinson[MVP]
 
E

Emir

Hi John
Categories is probably Text datatype since I can create new contacts with a
new category using a text string. I have tried accessing outlook interface
with syntax variations, also yours - without any success: It just does not
accept a Categories condition and returns an error with each time a
different code number.
Regards
Walter


John Vinson said:
Hello
My application works well in synchroizing contacts forth and back with
outlook by using functions similar to GetItemFromName, GetItemFromNames,
etc. as given in Microsofts Code Librarian. Unfortunately selectively
accessing categories with
strCriteria = "[Categories] = Test"
Set objFoundItems = fldContacts.Items.Restrict(strCriteria)
does not work.

Does anyone have a hint to give?

I'm not familiar with the Outlook interface, but I've done more than a
few strCriteria - and if Categories is a Text datatype (as appears to
be the case) you need some syntactically required quotemarks. To find
items where the Categories field contains the literal text string
"Test" use

strCriteria = "[Categories] = 'Test'"

or, if the word Test is embedded in a longer string,

strCriteria = "[Categories] LIKE '*Test*'"


John W. Vinson[MVP]
 

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