tags:

views:

34

answers:

1

Writing Outlook 2010 AddIn in c#

How to find contacts where for example FullName like "Name"

First I tried

string filter = "[FullName] = 'Name'";

and it works fine but only for the Name, but now I need to find contacts where FullName can be JonName or Peter Pen or ...

As I uinderstood I should use spacial query string in filter, but what to write?

Outlook.MAPIFolder folderContacts;
        Outlook.Items contactItems;
        Outlook.ContactItem contact;

        folderContacts = Globals.ThisAddIn.Application.ActiveExplorer().Session.
                 GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);

        contactItems = folderContacts.Items;

        string filter = "What should I write here?"; 
        var foundContacts = contactItems.Find(filter);
A: 

See the documentation.

string filter = "[FullName] ci_startswith  'Name'";

However, I highly recommend that you use the VSTO Power Tools (free download) instead; they will make your life much easier.

SLaks
string filter = "[FullName] ci_startswith 'Name'"; catch an exaption that it's impossible to analise, error in ci_startswithI tried to install VSTO Power Tools but installer say that can't find VS2008 - I use VS2010 What do do?
Janus