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.OlDefaultFolder开发者_Python百科s.olFolderContacts);
contactItems = folderContacts.Items;
string filter = "What should I write here?";
var foundContacts = contactItems.Find(filter);
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.
精彩评论