ContactCollection.Restrict how to check for contained string?

F

FCustom

Hi!
How to build in c# a query string to restrict contactcollection to all
contacts where firstname starts with specified letters?
I like to do something like addressbook research where contacts are
filtered from specified letters and so to show all contacts which
name
starts with 2 / 3 letters.

Actually I need to specify the complete name!

Thank you
 
P

Peter Foot [MVP]

The answer is not particularly obvious but you have to do two conditions,
e.g.

[FirstName] > 'D' AND [FirstName] < 'G'

Should return all items with first name beginning with D, E and F.

Peter
 
G

Guest

For the full name you could do something like, then filter yourself:

Microsoft.WindowsMobile.PocketOutlook.OutlookSession outlookSession2005
= new Microsoft.WindowsMobile.PocketOutlookSession();

System.ComponentModel.PropertyDescriptor p =
System.ComponentModel.TypeDescriptor.GetProperties
(typeof(Microsoft.WindowsMobile.PocketOutlook.Contact))["LastName"];
index = outlookSession2005.Contacts.Items.Find(p, "Bloggs");
if (index != -1)
{
//We found a match
}
 

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