Uses Restrict function on Contacts field of Appointment items

N

Neil Dittmar

Hello all,

I am attempting to use the Restrict function on a
collection of Appointment items to isolate which
appointments contain a specific Contact. A code sample is
as follows (where fldCateringCalendar contains all the
appointment items in a specific calendar folder):

'*** Begin Code Snippet ***'
strRestrictCriteria = "[Contacts]='John Smith'"
Set objCalendarItems = fldCateringCalendar.Restrict
(strRestrictCriteria)
'*** End Code Snippet ***'

If the Contacts field in the appointment ONLY contains
John Smith, then the Restrict function matches it and the
appointment is found in the objCalendarItems collection.
However, if the Contacts field contains another contact in
addition to John Smith (for example, John Smith; Mary
Jones), then the Restrict DOES NOT match and the
appoinment is not included in the objCalendarItems
collection.

Now for my question... is there a way to make Restrict
less restrictive so that if a contact is found in the
Contacts collection in the Appointment it will match
regardless of whether there are additional contacts
designated? Any help would be greatly appreciated.

Thanks,

Neil Dittmar
Software Developer
Aurora Information Systems
 
K

Ken Slovak - [MVP - Outlook]

There is no LIKE operator or wildcards that you can use in a restriction,
you have to use only the standard >, <, >=, <=, =, <> operators plus Or and
And (and Not).

You could use a CDO 1.21 MessageFilter or an Extended MAPI or Redemption
(www.dimastr.com/redemption) filter on a MAPITable, which are more flexible.
 

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